what's wrong with my date in this SQL?

  • Thread starter Thread starter Jesper F
  • Start date Start date
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.
 
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
 
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.
 
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") & "#"
 
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!
 
Back
Top