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

Using DLookup to populate and querying a combobox

Status
Not open for further replies.

OrionTC

Programmer
Dec 13, 2006
2
GB
I have a database with a table called client code, when I select the client code from a combo box I want it to filter by that selection and produce a list in another combo box based on that selection.

When the 2nd combo box brings up the list of relevant entries I then want to select from the combobox and have this populate (lookup) the rest of the fields.

Example:

Client Code 6000 (1st step)

Label Name BlaTape1 (2nd step)
Label Type T (auto pop 3rd step)
Tape Type Ultrium 2 (auto pop 3rd step)

So I select the client code this then brings up a list of label names which then populates the other fields.

I can use a Dlookup function like:
=DLookUp("[Label Type]","Label Type","[TapeType]='" & Forms![Label Request]!TapeType & "'")

But when I try to add this record into the table it will not populate it. I've read other posts on this and I believe its something to do with the control source and I need to move the code into AfterUpdate, but I can’t seem to get this working...

Also is it possible to have a lookup table of the entire values stored. Like a full list of tapes and labels which I can "filter" by selecting in the combo boxes and then once I selected it, add the record into a separate table which can be then reported upon. If I add the record into the same table it will populate the "lookup table"

To try and make it more clear.

tblLabelLookup = a list of values which I want to filter
tblRecord = a table in which the selected values above go into.

Thanks in advance for replies. I’ve played around trying to get this working but I can’t get it to populate correctly.

All help will be greatly appreciated
 
have a look at the FAQ I have written on security some also in access other topics. It shows how to filter and use dlookup. I use it to let user only see data for there department not other department data.

Never give up never give in.

There are no short cuts to anything worth doing :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top