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

Form lookup problem

Status
Not open for further replies.

mike91

Programmer
Aug 13, 2002
14
GB
I could really do with a pointer in the right direction, this is a pure Microsoft Access question

I have loads of my Clients details held within a database, I put at the top of a form a combo box and used the wizard to create a lookup, however it will only look up using the ID numbers,

Thus my drop down list, just gives me the ID of the record rather than the name of the company, if I use the ID say I select record 22 it display record 22, the code that is produced is as follows

Private Sub Combo85_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo85], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I have tried changing the [ID] to [company] but this makes it all fall over

Any ideas?????
 
Instead create a combo box with 2 columns, the id and the name of the company. You can have the combo "bound" to the column which contains the id, and also hide that column by setting it's width to 0. (I think the property is called columns width) Just set it equal to 0;2. This means the 1st column is hidden (0 width) and the 2nd has a width of 2.

Try using the combo box wizard. It should do a lot of this for you automatically. Maq [americanflag]
<insert witty signature here>
 
Worked a treat

Thank you - I did try this except I did not tell the program 0; 5 cm which is what I have now done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top