If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Access Form
In my form, I am trying to set up (2) fields that pull info from a list- the
1st field would have a combo box and pull a dept #, the 2nd field I want to automatcially update based on the value that matches the 1st field. So ex: the 1st field I would select a dept id based on a drop down list and the 2nd field I want updated with the dept name that coincides with the dept id in the 1st field. -- ls |
#2
|
|||
|
|||
Access Form
You didn't ask a question or give any details about your data, so it's kind
of difficult to give advice. How is your 1st field (the combo box) being populated (where is the list of data coming from)? If it's from a table or query, you can add the dept name as a 2nd column in the combo box, then in the AfterUpdate event of the combo box you can set the 2nd field value to the value in column 1 of the 1st field; for example, txtField2 = cboField1.Column(1). Alternatively, you can DLookUp to set the 2nd field to the dept name based on the dept id in the 1st field, something like txtField2 = DLookUp("[dept name]","[dept table]","[dept id]=" & cboField1) Again, this would go in the AfterUpdate event of the 1st field (the combo box). Note that I've used made-up names for the fields and controls; you will need to put in your actual field and control names. Hope these suggestions help, Carl Rapson "Lindascp" wrote in message ... In my form, I am trying to set up (2) fields that pull info from a list- the 1st field would have a combo box and pull a dept #, the 2nd field I want to automatcially update based on the value that matches the 1st field. So ex: the 1st field I would select a dept id based on a drop down list and the 2nd field I want updated with the dept name that coincides with the dept id in the 1st field. -- ls |
#3
|
|||
|
|||
Access Form
First idea, good
Alternative idea, bad Well, not bad - it will work, but why pay the overhead for the DLookup that is not necessary if you use the first idea. "Carl Rapson" wrote: You didn't ask a question or give any details about your data, so it's kind of difficult to give advice. How is your 1st field (the combo box) being populated (where is the list of data coming from)? If it's from a table or query, you can add the dept name as a 2nd column in the combo box, then in the AfterUpdate event of the combo box you can set the 2nd field value to the value in column 1 of the 1st field; for example, txtField2 = cboField1.Column(1). Alternatively, you can DLookUp to set the 2nd field to the dept name based on the dept id in the 1st field, something like txtField2 = DLookUp("[dept name]","[dept table]","[dept id]=" & cboField1) Again, this would go in the AfterUpdate event of the 1st field (the combo box). Note that I've used made-up names for the fields and controls; you will need to put in your actual field and control names. Hope these suggestions help, Carl Rapson "Lindascp" wrote in message ... In my form, I am trying to set up (2) fields that pull info from a list- the 1st field would have a combo box and pull a dept #, the 2nd field I want to automatcially update based on the value that matches the 1st field. So ex: the 1st field I would select a dept id based on a drop down list and the 2nd field I want updated with the dept name that coincides with the dept id in the 1st field. -- ls |
#4
|
|||
|
|||
Access Form
Just trying to cover all bases. Some people might find the DLookUp method
easier to implement than the multiple columns in a combo box. Of course, I may have only confused the OP. Carl Rapson "Klatuu" wrote in message ... First idea, good Alternative idea, bad Well, not bad - it will work, but why pay the overhead for the DLookup that is not necessary if you use the first idea. "Carl Rapson" wrote: You didn't ask a question or give any details about your data, so it's kind of difficult to give advice. How is your 1st field (the combo box) being populated (where is the list of data coming from)? If it's from a table or query, you can add the dept name as a 2nd column in the combo box, then in the AfterUpdate event of the combo box you can set the 2nd field value to the value in column 1 of the 1st field; for example, txtField2 = cboField1.Column(1). Alternatively, you can DLookUp to set the 2nd field to the dept name based on the dept id in the 1st field, something like txtField2 = DLookUp("[dept name]","[dept table]","[dept id]=" & cboField1) Again, this would go in the AfterUpdate event of the 1st field (the combo box). Note that I've used made-up names for the fields and controls; you will need to put in your actual field and control names. Hope these suggestions help, Carl Rapson "Lindascp" wrote in message ... In my form, I am trying to set up (2) fields that pull info from a list- the 1st field would have a combo box and pull a dept #, the 2nd field I want to automatcially update based on the value that matches the 1st field. So ex: the 1st field I would select a dept id based on a drop down list and the 2nd field I want updated with the dept name that coincides with the dept id in the 1st field. -- ls |
Thread Tools | |
Display Modes | |
|
|