473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DateValue() nor working

Hi.

Why is this DAO line producing error 3077 (Syntax error in number in
expression)?

rst.FindFirst "ValidFrom = " & DateValue(varDate)

rst is a defined recordset
varDate is a valid date.
ValidFrom is a valid field of the underlying table.

This line works!
rst.FindFirst "ValidFrom = #01,01,2000#"

TIA

--
Georges

Nov 12 '05 #1
3 1897
Georges Heinesch wrote:
Hi.

Why is this DAO line producing error 3077 (Syntax error in number in
expression)?

rst.FindFirst "ValidFrom = " & DateValue(varDate)

rst is a defined recordset
varDate is a valid date.
ValidFrom is a valid field of the underlying table.

This line works!
rst.FindFirst "ValidFrom = #01,01,2000#"


You need to delimit the date returned by DateValue(). It returns
a Variant (of subtype Date) so try this:

rst.FindFirst "ValidFrom = #" & DateValue(varDate) & "#"

But if varDate is a valid Date field then all you need to do is:

rst.FindFirst "ValidFrom = #" & varDate & "#"

--
'-------------------------------
' John Mishefske
'-------------------------------

Nov 12 '05 #2
John Mishefske wrote:
You need to delimit the date returned by DateValue(). It returns
a Variant (of subtype Date) so try this:

rst.FindFirst "ValidFrom = #" & DateValue(varDate) & "#"

But if varDate is a valid Date field then all you need to do is:

rst.FindFirst "ValidFrom = #" & varDate & "#"


Thanks for your reply.
Both of your suggestions were tested already before.
Both produced error 3077.

varDate is valid.
print.debug varDate says "01.01.2000"

I have no clue what goes wrong here!

--
Georges

Nov 12 '05 #3
Georges Heinesch wrote:
Thanks for your reply.
Both of your suggestions were tested already before.
Both produced error 3077.

varDate is valid.
print.debug varDate says "01.01.2000"

I have no clue what goes wrong here!


I found the error! In fact, the date was not formatted according to the
american system (but due to the locale settings, to the european
system). The code below did the job:

"ValidFrom < #" & Format(varDate, "mm\/dd\/yyyy") & "#"

Thanks.

--
Georges

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: CapeCoder | last post by:
I am using Access as the reporting front end to some linked SQL2000 tables. I'm told that if I use DateValue() or "WHERE field like %" in a query, the database engine bypasses any optimization...
3
by: J | last post by:
In Access 2000 the following query works: Select DateValue(EnteredTime) From tblMyTable But adding the following clause fails: Group by DateValue(EnteredTime) The error is:
3
by: Bruce Lawrence | last post by:
I've got a form that when it opens it prompts the user for 2 peices of information. The Asset and the Date. getasset = InputBox("Enter the Asset Number") If getasset = "" Then Exit Sub Else...
4
by: anniebai | last post by:
In our database, the publication year and month are saved in different columns, the query is to find out the pubs after 7/1/2006. My following query works but not get the desired dataset, e.g....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.