Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Combo box selection to update form. 1

Status
Not open for further replies.

jmob

Programmer
Jun 21, 2005
58
US
I am trying to update my form based upon a combobox selection of a date. Two fields make up the Primary Key in the Table(form). idA, idB. Based upon the date Selection in the combo box, I would like to update the rest of the fields on the form.
I have some code that works for a one field primary key, but can't figure it out with 2 fields. Thanks!!!
 
Your description is real vague so not sure this is the answer but to combine 2 fields use an ampersand "&"

if me.combo1= field1 & field2 then...

 
Hopefully this is a little more clear:
On another one of my forms, this code is in the afterupdate() of my comboBox
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[idA] = " & Str(Nz(Me![Combo1], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
My new form has 2 keys that make the primary key, so I think i need another [idB]= added somewhere in the code above.
Thanks.
 
Example:
rs.FindFirst "[idA] = " & Str(Nz(Me![Combo1], 0)) & " AND idB=" & Nz(Me!Combo1.Column(1), 0)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top