Query DLookup Syntax error

  • Thread starter NoLegalMoves via AccessMonster.com
  • Start date
N

NoLegalMoves via AccessMonster.com

I have the following column in a query that returns a syntax error.
Any idea why?

Hours: DLookUp("[Hour]","[TB_Productivity]","[Timestamp] =" & [MaxOfTimeStamp]
)
 
J

John Spencer

As a guess your field named timestamp is a date time field. If that is the
case then you need to add the date time delimiter {#) into your Dlookup.


Hours: DLookUp("[Hour]", "[TB_Productivity]", "[Timestamp] = #" &
[MaxOfTimeStamp] & "#")


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
M

MGFoster

NoLegalMoves said:
I have the following column in a query that returns a syntax error.
Any idea why?

Hours: DLookUp("[Hour]","[TB_Productivity]","[Timestamp] =" & [MaxOfTimeStamp]
)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Try putting # delimiters around the time data:

"[Timestamp] = #" & [MaxOfTimeStamp] & "#" )

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSrFRC4echKqOuFEgEQIE7gCg3a6vLQgvBj1tBJG1tp9ZjuqNAWgAoKIv
7c2aeHwIqVnIFWK57bkAOKYO
=tx70
-----END PGP SIGNATURE-----
 
D

Duane Hookom

What is the data type of TimeStamp? If it is datetime, try
Hours: DLookUp("[Hour]","[TB_Productivity]","[Timestamp] =#" &
[MaxOfTimeStamp] & "#" )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top