UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Help With Query With Date Parameters    
 
   
eacollie
post Apr 1 2012, 07:11 PM
Post #1

UtterAccess Veteran
Posts: 408
From: Tennessee



I have a form based on this query:

CODE
SELECT qryReservationsMC.*, IIf([AddedToOutlook]=True,"*","|") AS Status
FROM qryReservationsMC
WHERE (((qryReservationsMC.EndDate)>=Format([Forms]![frmCalendar]![txtDate],"Short Date")) AND ((qryReservationsMC.StartDate)<=Format([Forms]![frmCalendar]![txtDate],"Short Date")));


It gives me an error "the expression is typed incorrectly or is too complicated..." I think I need "#" for the dates.

Any help?
Go to the top of the page
 
+
Doug Steele
post Apr 1 2012, 07:26 PM
Post #2

UtterAccess VIP
Posts: 17,644
From: Don Mills, ON (Canada)



Don't use the Format function: that actually converts the value to text, which is part of your problem. Instead, declare the parameter as Date:

CODE
PARAMETERS [Forms]![frmCalendar]![txtDate] DateTime;
SELECT qryReservationsMC.*, IIf([AddedToOutlook]=True,"*","|") AS Status
FROM qryReservationsMC
WHERE qryReservationsMC.EndDate)>=[Forms]![frmCalendar]![txtDate]
AND qryReservationsMC.StartDate)<=[Forms]![frmCalendar]![txtDate];


(Yes, that's a semi-colon between DateTime and SELECT!)
Go to the top of the page
 
+
eacollie
post Apr 1 2012, 08:02 PM
Post #3

UtterAccess Veteran
Posts: 408
From: Tennessee



Wow! Thank you so much Doug! That took care of the problem.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 25th May 2013 - 09:21 PM