By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,225 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,225 IT Pros & Developers. It's quick & easy.

Auto fill or populate a form

P: 10
I'm trying to get a row of a List Box (13 columns) to auto fill into 5 List Boxes and 8 Text

Boxes on a form when clicked.

List Box Name: List 166
Row Source: SELECT [Battlefield Roster].UPC, [Battlefield Roster].PARA, [Battlefield

Roster].LINE, [Battlefield Roster].[POSITION TITLE], [Battlefield Roster].RANK, [Battlefield

Roster].Grade, [Battlefield Roster].DMOS, [Battlefield Roster].[ID CODE], [Battlefield Roster].

[ASI I], [Battlefield Roster].[ASI II], [Battlefield Roster].[ASI III], [Battlefield Roster].

[MTOE REQUIRED], [Battlefield Roster].AUTH FROM [Battlefield Roster] ORDER BY [UPC], [PARA],

[LINE];

To go into example
List Box Name: Position Title
Text Box Name: PARA

Thank you for any help,

Harry
Jan 23 '08 #1
Share this Question
Share on Google+
6 Replies


ADezii
Expert 5K+
P: 8,679
I'm trying to get a row of a List Box (13 columns) to auto fill into 5 List Boxes and 8 Text

Boxes on a form when clicked.

List Box Name: List 166
Row Source: SELECT [Battlefield Roster].UPC, [Battlefield Roster].PARA, [Battlefield

Roster].LINE, [Battlefield Roster].[POSITION TITLE], [Battlefield Roster].RANK, [Battlefield

Roster].Grade, [Battlefield Roster].DMOS, [Battlefield Roster].[ID CODE], [Battlefield Roster].

[ASI I], [Battlefield Roster].[ASI II], [Battlefield Roster].[ASI III], [Battlefield Roster].

[MTOE REQUIRED], [Battlefield Roster].AUTH FROM [Battlefield Roster] ORDER BY [UPC], [PARA],

[LINE];

To go into example
List Box Name: Position Title
Text Box Name: PARA

Thank you for any help,

Harry
It would be somethink like this, in the List Box's Click() Event. Substitute your own Control Names:
Expand|Select|Wrap|Line Numbers
  1. Private Sub List_166_Click()
  2.   Me![lstUPC] = Me![List 166].Column(0)
  3.   Me![lstPARA] = Me![List 166].Column(1)
  4.   Me![lstLINE] =  Me![List 166].Column(2)
  5.   Me![lstPOSITION TITLE] = Me![List 166].Column(3)
  6.   Me![lstRANK] =  Me![List 166].Column(4)
  7.   Me![txtGRADE] = Me![List 166].Column(5)
  8.   Me![txtDMOS] = Me![List 166].Column(6)
  9.   Me![txtID CODE] = Me![List 166].Column(7)
  10.   Me![txtASI I] =  Me![List 166].Column(8)
  11.   Me![txtASI II] = Me![List 166].Column(9)
  12.   Me![txtASI III] = Me![List 166].Column(10)
  13.   Me![txtMTOE REQUIRED] = Me![List 166].Column(11)
  14.   Me![txtAUTH FROM] = Me![List 166].Column(12)
  15. End Sub
Jan 23 '08 #2

P: 10
First off, THANKYOU!!! Worked good but...2 things I still have a problem with

Here is the code:

Private Sub List166_AfterUpdate()


Me![lstUPC] = Me![List166].Column(0)
Me![txtPARA] = Me![List166].Column(1)
Me![txtLine] = Me![List166].Column(2)
Me![lstPosition Title] = Me![List166].Column(3)
Me![lstRank] = Me![List166].Column(4)
Me![lstGrade] = Me![List166].Column(5)
Me![txtDMOS] = Me![List166].Column(6)
Me![lstID Code] = Me![List166].Column(7)
Me![txtASI I] = Me![List166].Column(8)
Me![txtASI II] = Me![List166].Column(9)
Me![txtASI III] = Me![List166].Column(10)
Me![txtMTOE Required] = Me![List166].Column(11)
Me![txtAUTH] = Me![List166].Column(12)
End Sub

First is the first one txtUPC, doesnt get changed,

And 2nd is when I click on a row in the List Box (List166) to be changed , the row I click doesnt stay highlighted, it'll hightlight the first on in a group of UPC, if I have A1, A2, A3, A4, A5 and I click 2, 3, 4 or 5 , 1 will hightlight.

Thank you again
Jan 23 '08 #3

ADezii
Expert 5K+
P: 8,679
First off, THANKYOU!!! Worked good but...2 things I still have a problem with

Here is the code:

Private Sub List166_AfterUpdate()


Me![lstUPC] = Me![List166].Column(0)
Me![txtPARA] = Me![List166].Column(1)
Me![txtLine] = Me![List166].Column(2)
Me![lstPosition Title] = Me![List166].Column(3)
Me![lstRank] = Me![List166].Column(4)
Me![lstGrade] = Me![List166].Column(5)
Me![txtDMOS] = Me![List166].Column(6)
Me![lstID Code] = Me![List166].Column(7)
Me![txtASI I] = Me![List166].Column(8)
Me![txtASI II] = Me![List166].Column(9)
Me![txtASI III] = Me![List166].Column(10)
Me![txtMTOE Required] = Me![List166].Column(11)
Me![txtAUTH] = Me![List166].Column(12)
End Sub

First is the first one txtUPC, doesnt get changed,

And 2nd is when I click on a row in the List Box (List166) to be changed , the row I click doesnt stay highlighted, it'll hightlight the first on in a group of UPC, if I have A1, A2, A3, A4, A5 and I click 2, 3, 4 or 5 , 1 will hightlight.

Thank you again
First is the first one txtUPC, doesnt get changed,
Probably a typographical error on the Field Name.

And 2nd is when I click on a row in the List Box (List166) to be changed , the row I click doesn't stay highlighted, it'll hightlight the first on in a group of UPC, if I have A1, A2, A3, A4, A5 and I click 2, 3, 4 or 5 , 1 will hightlight.
Set the Multi Select Property of the List Box to Simple, then individual items that were selected will stay highlighted. If you need to de-select all the items at some point, I can show you how to do that.
Jan 23 '08 #4

P: 10
Probably a typographical error on the Field Name.
Thank you highlight fixed.

Still having a problem with 2 boxes not getting filled, lst UPC and lstGrade. They all work but them 2.
Jan 23 '08 #5

ADezii
Expert 5K+
P: 8,679
Thank you highlight fixed.

Still having a problem with 2 boxes not getting filled, lst UPC and lstGrade. They all work but them 2.
As long as they are properly identified and th proper Columns are referenced, I canot see why this would be happening. If you like, I'll send you my E-Mail address in a Private Message, and you can send me the Database as an Attachment. As soon as I get a chance, I would be more than happy to have a look at it, and hopefully solve the problem. Let me know either way.
Jan 23 '08 #6

P: 10
As long as they are properly identified and th proper Columns are referenced, I canot see why this would be happening. If you like, I'll send you my E-Mail address in a Private Message, and you can send me the Database as an Attachment. As soon as I get a chance, I would be more than happy to have a look at it, and hopefully solve the problem. Let me know either way.
Absolutely that would be great.
Jan 23 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.