Dlookup Function Error

wrweaver

Registered User.
Local time
Today, 07:14
Joined
Feb 26, 2013
Messages
75
I have a button that opens up a form with a dlookup function that automatically fills out the fields in that form. I have attached a sample DB to save time explaining. SectorF contains a list of Stations, double clicking opens up the StationF which contains a list of buildings. Double clicking there opens up the BuildingF which contains a list of assets. At any level you should be able to click the Create work order button to open up the workorderF with information already filled in up to the level you're creating from. The button on the assetF though keeps giving me an error in the dlookup function. Any help is greatly appreciated! Thanks!
 

Attachments

I have a button that opens up a form with a dlookup function that automatically fills out the fields in that form. I have attached a sample DB to save time explaining. SectorF contains a list of Stations, double clicking opens up the StationF which contains a list of buildings. Double clicking there opens up the BuildingF which contains a list of assets. At any level you should be able to click the Create work order button to open up the workorderF with information already filled in up to the level you're creating from. The button on the assetF though keeps giving me an error in the dlookup function. Any help is greatly appreciated! Thanks!

You have a circular reference in the Asset Dlookup. The line should be - my best guess :

Code:
Forms!WorkOrderF!SectorCombo = DLookup("SectorID", "SectorT", "SectorID=" & [B]Forms![StationF[/B]]!SectorCombo)

There have a second problem with the Building Dlookup a couple of lines down. It craps out too and for the same reason: again my best guess is that it should be something like:

Code:
Forms!WorkOrderF!StationCombo = DLookup("StationID", "BuildingT", "BuildingID=" & [B]Forms![BuildingF]!BuildingID[/B])

I hope this solves it for you. :)

Best,
Jiri
 
Thanks. I replaced the code with your suggestions but then I get an error in the Stationcombo dlookup line that says:

Run-time error '3075'"
Syntax error (missing operator) in query expression 'StationID='.
 
Nevermind. I figured it out. Something was spelled wrong! Thanks for your help!!!
 
Thanks. I replaced the code with your suggestions but then I get an error in the Stationcombo dlookup line that says:

Run-time error '3075'"
Syntax error (missing operator) in query expression 'StationID='.

Did you fix the second Station Combo line the way I suggested above ?

Jiri
 

Users who are viewing this thread

Back
Top Bottom