ComboBox Lookup Problems

C

Catherine

Right now I have a Combobox that you can select a device and it will bring up
information about that device and by hitting an edit button you can in turn
edit this information. The way this happens is the combobox becomes hidden
and a text box appears and then I requery the combobox incase any changes
were made when you hit the done editing button. This works fine for devices
already in the database.

But say I have device A and I want to add device B I click edit and add
device B to the DB when I am done editing I click Done Editing and the
combobox re-appear. The problem is the comboboxes still stay device A while
the information for that device is for device B. (the information is on a
subform of the form that the combobox is located) But I can click on device
A on the combobox and get the correct information again. So what I want to do
is force the combobox to go to the correct device. Each device has a unique
Device ID (Autonumber, also the primary key)

Here is my attempt:

' Device = name of combobox
' [Device Name] = the name of the Field in the qry_EditDevice which is the
query that the combobox is based off of
' [Device ID] = the name of the Field that the combobox is bound to from the
query
' DID = the Device ID of the Device that the combobox should be showing

Device = DLookup("[Device Name]", "qry_EditDevice", "[DeviceID] = 'DID'")

I don't even know if DLookup is the correct Method for what I am trying to
do. Thank You in Advance for any help you can give me.

Catherine
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top