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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display records... 1

Status
Not open for further replies.

shaddow

Programmer
Mar 22, 2001
1,862
RO
I have two tables
tblProducts
id Number
name Text

tblData
name Text
field1 Text
field2 Text

i have an relation one to one on the name field on both tables.
I want to display the values from field1 and field2 refered to the name i chose from the combobox. Hope you understand what i ment to say... ________
George, M
 
First, is there a reason that you don't have ID in the second table? Names are easy to duplicate.

Anyway, I would use a multicolumn combo with a rowsource set to a SQL statement "Select Name, Field1, Field2, ID from tblProducts, tblData
Where tblProducts.[Name]=tblData.[Name]"

set columncount = 4, columnwidths = 1";0";0";0" (to hide the other three columns. On MyCombo_afterUpdate() place this code:

With Me
If Not IsNull(.MyCombo.Value) Or (.MyCombo.Value <> &quot;&quot;) Then
'Push the value of the columns into the textfields
.MyText1.Value = .MyCombo.Column(1)
.mytext2.value = .mycombo.column(2)
End If
End With

that should work

Hope that helps.

Bob


 
Thanks, it works, and is so simple, i dont even use another querry i use the same querry but other fields... ________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top