what's wrong with my date in this SQL?

J

Jesper F

Where I'm at the date format is dd/mm/yyyy.

What's wrong with this SQL?

Dim Limit as Date
Limit = DateAdd("m", -6, date())
Limit = Format(Frist, "mm/dd/yyyy")
SQL = "SELECT tbl.* FROM tbl WHERE tbl.lastedit < #" &
Limit & "#"

I get the 3061-error: Too few parameters.

This in itself doesn't work either.
SQL = "SELECT tbl.* FROM tbl WHERE (tbl.lastedit) < #" &
Format$(DateAdd("m", -6, Idag), "mm/dd/yyyy") & "#"


Thanks.
 
C

Cameron Sutherland

in your line:
Limit = Format(Frist, "mm/dd/yyyy")
That does the word Frist mean? I expected to see the line
as:
Limit = Format(Limit, "mm/dd/yyyy")
-Cameron Sutherland
 
J

Jesper F

in your line:
Limit = Format(Frist, "mm/dd/yyyy")
That does the word Frist mean? I expected to see the line
as: Limit = Format(Limit, "mm/dd/yyyy")

yeah, sorry. English is not my native language, so I
forgot som translation.
I do have it as: Limit = Format(Limit, "mm/dd/yyyy")
but I can't seem to get it to work.
 
J

Jesper F

This is how I've done it:

Dim Limit as Date
Limit = DateAdd("m", -6, date())
Limit = Format(Limit, "mm/dd/yyyy")
SQL = "SELECT tbl.* FROM tbl WHERE tbl.lastedit < #" &
Limit & "#"

I get the 3061-error: Too few parameters.

This in itself doesn't work either.
SQL = "SELECT tbl.* FROM tbl WHERE (tbl.lastedit) < #" &
Format$(DateAdd("m", -6, date()), "mm/dd/yyyy") & "#"
 
A

Andrew Smith

Andrew Smith said:
Try doing it without the format function if you live in the UK, and you'll
appreciate that it's essential!

Ooops - just saw Allen Browne's reply, and then read the original message
properly. You're quite right!
 

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

Similar Threads


Top