[AccessD] Numbers in DLookup

Charlotte Foust cfoust at infostatsystems.com
Mon Mar 20 15:50:21 CST 2006


Glad to help.  That's the first thing to try when Access starts
objecting to the name of an object. 


Charlotte Foust

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob Heygood
Sent: Monday, March 20, 2006 1:27 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Numbers in DLookup

Sure enough, the brackets make the difference.

Works:  varData = Nz(DLookup("[" & strFieldName & "]", strTableName,
"CoID =" & intCoID))

No Work:  varData = Nz(DLookup(strFieldName, strTableName, "CoID =" &
intCoID))


Thanks Charlotte

bob




Put the value with numbers at the front in square brackets, same as you
would for a name with a space in it, and see if that makes a difference.



Charlotte Foust


Hello to the list!
I am trying to use a DLookup function in some code.
It uses two string variable values for the Expr and the Domain
arguments.
And a third string variable for the part of the Where clause.

This works fine until the value of the Expr string contains digits
anywhere but at the end of the string. Hard to believe, but when I
remove the records from the table from which I derive the string, works
fine. But if I leave in those records that contain a one or more digits
except at the end, it give the error message:

Syntax error(missing operator) in query expression
'2004TotalTurnoverED207'.

Sure enough, 2004TotalTurnoverED207 is the correct value.
Other values such as TotalHours, TotalMan201 and AveUnits45 all work
fine in the DLookup as values for the Expr, just not when the digits
occur anywhere but at the end of the string.

Any help would prevent further head banging.

TIA

bob


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list