Passing Dates To A Between Operator

E

EarlCPhillips

I have a form "Scheduled" showing which groups of volunteers will be here on
a given date. It is opened by a command button click event and some VBA
code. The data source query has a Between [Start Date] And [End Date]
operator within it that requests the user enter the starting and ending dates
for the "Scheduled" data.

I now want to call the "Scheduled" form from within another form displaying
"total volunteers" expected for that range of dates. I want to capture the
date from a record on the "total volunteers" form and pass it to the
"Scheduled" forms' record source queries' Between operators programmatically.
I am able to capture the date from the "total volunteers" form just fine,
but I cannot seem to pass that date to the query operator Between [Start
Date] And [End Date] either before or after opening the "Scheduled" form.

How would I programmatically pass the same date to [Start Date] and [End
Date] of the "Scheduled" source data query's Between operator?

EarlCPhillips
Ex-Mainframer Trying To Learn Access
 
E

EarlCPhillips

I built a DoCom with a Where clause, trying to stop the automatic request for
input.
The where clause stWhere = "(((tblActivity.ScheduleDate) Between " &
[Forms]![frmTestScheduled]![txtDate] & " And " &
[Forms]![frmTestScheduled]![txtDate] & ") AND ((tblActivity.Activity)=" &
[Forms].[frmMain].[cboActivity] & "))" is my attempt to fill in what the
query will ask for, but the answer I get from Access is "Object does not
support this property or method (438)". Form frmTestScheduled is the "Total
Volunteers" and "AllScheduled2" is the "Scheduled" form.

I changed it to stwhere = "(((tblActivity.ScheduleDate) Between " & dtmStart
& " And " & dtmStart & ") AND ((tblActivity.Activity)=" & strCode & "))"
where I earlier fetched the date and activity code from "Total Volunteers".
When it starts to open the form, it still asks for user input of dates and
ignors the above where clause. I am trying to avoid having the user enter
dates when I know what the dates are in advance.

Thanks for the thought, but it does not work per my understanding of what
you were trying to convey.

Anybody else?
EarlCPhillips
Volunteer Programmer at Local Food Bank
--
Trying To Feed The Hungry


Roger Carlson said:
If I am reading this correctly, you should just be able to reference the
"total volunteers" for in the query for the Scheduled form. In other words:

Between [forms]![total volunteers]![Start Date] And [forms]![total
volunteers]![End Date]

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


EarlCPhillips said:
I have a form "Scheduled" showing which groups of volunteers will be here
on
a given date. It is opened by a command button click event and some VBA
code. The data source query has a Between [Start Date] And [End Date]
operator within it that requests the user enter the starting and ending
dates
for the "Scheduled" data.

I now want to call the "Scheduled" form from within another form
displaying
"total volunteers" expected for that range of dates. I want to capture
the
date from a record on the "total volunteers" form and pass it to the
"Scheduled" forms' record source queries' Between operators
programmatically.
I am able to capture the date from the "total volunteers" form just fine,
but I cannot seem to pass that date to the query operator Between [Start
Date] And [End Date] either before or after opening the "Scheduled" form.

How would I programmatically pass the same date to [Start Date] and [End
Date] of the "Scheduled" source data query's Between operator?

EarlCPhillips
Ex-Mainframer Trying To Learn Access


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top