This is probably a simple question for someone out there.
I understand that the DLookup function takes has the following syntax:
DLookup(express ion,domain,[criteria])
From what I have read, domain can be a table or query.
I have no problem getting the function to work when I use the actual name of a table for the domain. My question is, can I utilize a combobox that lists the names of my tables and pass the value of the selected table from the combo box to the DLookup function as the domain?
For example, I have a Form named Form1 with a combobox named cmbTables that lists the following table names:
Table1
Table2
Table3
In the DLookup function, is it possible to do something like this:
DLookup("[Names]","[Forms]![Form1].cmbTables","[LastName] = 'Jones'")
I was hoping this, or some sort of similar code, would translate to this:
DLookup("[Names]","Table1","'La stName] = 'Jones'")
Thanks for any and all help.
I understand that the DLookup function takes has the following syntax:
DLookup(express ion,domain,[criteria])
From what I have read, domain can be a table or query.
I have no problem getting the function to work when I use the actual name of a table for the domain. My question is, can I utilize a combobox that lists the names of my tables and pass the value of the selected table from the combo box to the DLookup function as the domain?
For example, I have a Form named Form1 with a combobox named cmbTables that lists the following table names:
Table1
Table2
Table3
In the DLookup function, is it possible to do something like this:
DLookup("[Names]","[Forms]![Form1].cmbTables","[LastName] = 'Jones'")
I was hoping this, or some sort of similar code, would translate to this:
DLookup("[Names]","Table1","'La stName] = 'Jones'")
Thanks for any and all help.
Comment