Reputation: 1
I am trying to pull data from an unlinked table and place it in a form so you can view the data in the table.
I have been down many routes and am trying to use Dlookup for each field I wand to fill but am getting the error message Data Mismatch in Criteria expression.
This is what I have
cboContactTitle = DLookup("ContactTitle", "BusinessAccountOpening", "[ID] ='" & Me.txtID & "'")
Where am I going wrong
Upvotes: 0
Views: 142
Reputation: 6336
Looks like ID
field is numeric. Remove single quotes.
DLookup is not the best way for pulling data to the form. Probably you can bound the table to the form and form fields will show table data much faster and without additional code
If you need to display the data in multiple unbound fields I would recommend to open a recordset and copy required data to the form fields from recordset fields. For 1-2 fields DLookup is fine.
Upvotes: 2