I have a text box in my main form. I like to use DLookUp function as its control source to populate it with a single numeric value called CF.
The reason I like to use DLookup function because I don't want the table containing CF to be opened when I am on my main form. This is becasue I am referencing the CF table in one of my modules that also runs only when my main form is open. So If my CF table is open while I am on my main form, the module gives me error.
I tried using this but it doesn't work
DLookup("[CF]","[CFTable]","[PG] = Forms![MainForm]![lbx_PG]" And "[DC] = Forms![MainForm]![lbx_DC]")
Forms![MainForm]![lbx_PG] will return a numeric value
Forms![MainForm]![lbx_DC] will return a numeric value
I also tried using this but it doesn't work either:
DLookup("[CF]","[CFTable]","[PG] =" & Forms![MainForm]![lbx_PG] & "And" & "[DC] =" & Forms![MainForm]![lbx_DC])
Any ideas/help will be highly appreciated. Thanks
Jay
The reason I like to use DLookup function because I don't want the table containing CF to be opened when I am on my main form. This is becasue I am referencing the CF table in one of my modules that also runs only when my main form is open. So If my CF table is open while I am on my main form, the module gives me error.
I tried using this but it doesn't work
DLookup("[CF]","[CFTable]","[PG] = Forms![MainForm]![lbx_PG]" And "[DC] = Forms![MainForm]![lbx_DC]")
Forms![MainForm]![lbx_PG] will return a numeric value
Forms![MainForm]![lbx_DC] will return a numeric value
I also tried using this but it doesn't work either:
DLookup("[CF]","[CFTable]","[PG] =" & Forms![MainForm]![lbx_PG] & "And" & "[DC] =" & Forms![MainForm]![lbx_DC])
Any ideas/help will be highly appreciated. Thanks
Jay