LINKING QUERIES TO FORM

BLADERUNNERSPS

New Member
Joined
Apr 14, 2005
Messages
1
I am trying to link a query to a form to bring back information for the date the form is on. The current criteria in the query is as follows

Between ([Forms]![Form2]![FROM].[Caption]) And ([Forms]![Form2]![TO].[Caption])

Forms is a calendar and forms2 is a calendar

Forms is on 13/04/05 and forms2 is on 14/04/05

When the query is run data is being returned for the 13/04/05 and the 14/04/05 if I change forms to show the same day, some of the data is not retuned for that day.

Any advice greatly appreciated.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Using the Between

Bladerunner,
Remember that dates used in the "between" conditional default to midnight on those dates unless a time component is included with the dates. So to include the entire date of 14/04/05 you really want the "TO" date/time to be 14/04/05 11:59:59 PM. For easier use, since not too many applications have changes in the final few minutes of a day, you could add another day onto the "TO"; in other words make the "TO" 15/04/05. That would make the default time to the midnight and then really include the entire 14/04/05 day.
 
Upvote 0
Bladerunner

Oh, I forgot...
Also you are bringing in the .Caption property of a form's labels, which is a text character string. To convert a string to a date you'll need to enclose the text inside the pound symbols; #14/04/05#. This needs to be done for both your FROM and TO dates.

And, of course, you can also use the CDate() function too instead of the # symbols.
 
Upvote 0

Forum statistics

Threads
1,221,904
Messages
6,162,745
Members
451,785
Latest member
DanielCorn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top