VBA DLookup to an excel range (1 Viewer)

flaghippo

Registered User.
Local time
Yesterday, 22:59
Joined
Jan 22, 2012
Messages
19
Hi All
I am having problems with Dlookup from a table which is linked to Excel.
The heading on the fields from Excel have been imported as
F1, F2, F3 etc... the code I am using is as follows .....

LOOK = DLookup("F6", "DATABASE_LOOKUP", "F1 = 1338087")

F6 = A date I am looking up.
DATABASE_LOOKUP = table I am looking up.
F1 = 1338087 = The record I am looking for.

Error is Run-time 3464.
Data type mismatch in criteria expression.

Thanks
 

vbaInet

AWF VIP
Local time
Today, 06:59
Joined
Jan 22, 2010
Messages
26,374
F1 is probably reading as Text:
Code:
"F1 = [B][COLOR="Red"]'[/COLOR][/B]1338087[COLOR="red"][B]'[/B][/COLOR]"
 

pr2-eugin

Super Moderator
Local time
Today, 06:59
Joined
Nov 30, 2011
Messages
8,494
Also what have you declared LOOK as? If it is anything other than variant, possibility is that you are trying to assign a Null to a String/Number type.
 

flaghippo

Registered User.
Local time
Yesterday, 22:59
Joined
Jan 22, 2012
Messages
19
Hi all and thanks for your responce.
It is working now but only finds the first record !
Any further help would be great.
Thanks
 

Users who are viewing this thread

Top Bottom