var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: VBA - Using Between in a WHERE Statement
I have asked this before but the "answer" did not work
Doing a search looking for a range of dates based off company name
where1 = ??
Main.ShipDate Between Date1 And Date2
and = Company.Value
Are your dates in the code variables or field names?
If they are field names you might have to a) bracket them and b) put them between # signs for the date value to work.
Why not go ahead anp post your SQL and we can take a look.
thank you the # signs are what I was missing
Originally Posted by Darasen
where1 = "[Main]![ShipDate] " & " Between " & "#" & range1 & "#" & " AND " & "#" & range2 & "#"
where2 = " And [Main]![ShipperID]" & "=" & Shipper.Value & " And [Main]![ConsigneeID]" & "=" & Consignee.Value
DoCmd.OpenReport "pickupsheet", acViewPreview, , where1 & where2
range1.Value = Null
range2.Value = Null
Shipper.Value = Null
Consignee.Value = Null
Those darn # signs....get you everytime!
Don't forget the date has to be in the US format 'mm/dd/yyyy' So you may have to use format(range,"mm/dd/yyyy")