DLookUp with 2 criteria

connerlowen

Registered User.
Local time
Today, 05:39
Joined
May 18, 2015
Messages
204
HI,

I have a form that has a field that needs to get its data from a query based on two fields in the form. The following is my DLookUp statement:

DLookup("[COMEX]", "OptionMetalsListQ", "[Metals] = '" & [cboMetals].[Column](1) & "'" And "[DateOfPrice] = " & Me.txtDateOfPrice)

Comex is a metal market. the bound column in cboMetals is text and The date is a date.

I am getting the error "Run-time error '13': Type Mismatch.

I cannot figure out what I need to change. Any help would be greatly appreciated.

Thanks,

Conner Owen
 
try

DLookup("[COMEX]", "OptionMetalsListQ", "[Metals] = '" & [cboMetals].[Column](1) & "' And [DateOfPrice] = #" & format(txtDateOfPrice,"mm/dd/yyyy") & "#")
 
I am no longer getting the error, however it is not returning the value it should be returning.

Edit: I realized that my field "DateOfPrice" was actually "DateOfPrices". After adding the "s" all is working correctly.

Thank you so much!!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom