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

Search 2nd table for match in main table

Status
Not open for further replies.

Omono

MIS
Apr 20, 2001
24
0
0
US
I have a main form, inventory, with its accompaning table. I have a second table, peripherals, which list the other equipment. The primary key in the main table is the inventory asset number which I have joined to a field in the peripherals table called location, which is the asset number of the invetory the peripheral is connected to. On the main form is a cmdbutton that displays any peripherals connected to a computer. Of course, if I select the cmdbutton and no peripherals are connected to that user then it displays a blank peripheral form. With all that said, what I would like to do is to disable the cmdbutton unless the computer does have peripherals attached. To do that I know I have to compare location number in the 2nd table to the inventory asset number displayed on the form (from the main table)and if the same number is located then enable the cmdbutton. I am stuck on this... thanks in advance.
 
cmdbutton.Enabled = not IsNull(Dlookup("location","peripherals","location=" & [asset number]))

run this in the main form's OnCurrent event.
 
Thanks LambertH for your quick reply. I neglected to tell you that I'm using Access 2002 (Office XP Pro). It's looking for macro 'cmdbutton' I'm researching now how to perform dlookup's in Access 2002.
 
I assumed that the name of your command button was 'cmdbutton', just change the code to reflect the real name of the control.

AFAIK, Access 2002 dos Dlookup's the same as Acces 97, but I could be wrong there.
 
Thank you LambertH. I finally got your suggestion to work. Sorry it has taken me so long to respond.... Thanks ever so much for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top