Trying to expand this query to include querying the variable date to an existing date less a day.. Or another way to look at it may be the variable date plus one against and existing date.. The error I get is Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/campbookings1/1NEMO_copy(1)/4DateQuery_Nemo.asp, line 10
mySQL = "SELECT CampSite FROM NEMO1 WHERE ((#"&varDateStart&"# Between DateStart And DateEnd) OR (#"&varDateEnd&"# Between DateStart And DateEnd) OR (#"&varDateStart&"# = DateAdd(d,-1,DateStart)))"
rdouglass -> RE: DateAdd - asp code (4/3/2008 13:46:47)
quote:
DateAdd(d,-1,DateStart)
Have you tried it this way?
DateAdd('d',-1,DateStart)
If that errors, try with double quotes. I can never remember when passing to Access.
I assume you are using Access with the # date delimiters?
rdouglass -> RE: DateAdd - asp code (4/3/2008 13:53:04)
After looking at this:
mySQL = "SELECT CampSite FROM NEMO1 WHERE ((#"&varDateStart&"# Between DateStart And DateEnd) OR (#"&varDateEnd&"# Between DateStart And DateEnd) OR (#"&varDateStart&"# = DateAdd(d,-1,DateStart)))"
is perhaps the logic a little sideways? Could you not do it like this instead?
mySQL = "SELECT CampSite FROM NEMO1 WHERE ((DateAdd('d',-1,DateStart) BETWEEN #"&varDateStart&"# AND #"&varDateEnd&"#) OR (DateEnd BETWEEN #"&varDateStart&"# AND #"&varDateEnd&"#)"
That *should* get all of those BETWEEN as well as the day before. That make any sense what I'm suggesting?
rikki -> RE: DateAdd - asp code (4/3/2008 14:14:57)
Hey - it works just like I want!! Thank you so much.. It is single quotes btw..