Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2007

Tip: Looking for answers? Try searching our database.

Date Range Dialog Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
msgulf - 24 Jan 2007 22:16 GMT
I have a dialog box that requests the date range for a report and it works
fine for that report.  I'm simply using a macro to open that particular
report when the OK command button is clicked.  Is there a way--using macros
or VBA--to make this one dialog box work for multiple reports?  Thanks in
advance!
chris.nebinger@gmail.com - 24 Jan 2007 23:35 GMT
Through macros?  Probably.

Lets say your form is named frmDateRange.
You have a control txtDateStart and txtDateEnd.

You also have a close button.  But, instead of closing it, you actually
just hide the form.  On the OnClick event of the close button, use:

Me.Visible = True

Your macro should open this form modally, then open any report.  The
report's query source should have:

[DateFieldName]
Condition:
Between Forms!frmDateRange!txtDateStart and
Forms!frmDateRange!txtDateEnd

Let me know if that doesn't make sense.

Chris Nebinger

> I have a dialog box that requests the date range for a report and it works
> fine for that report.  I'm simply using a macro to open that particular
> report when the OK command button is clicked.  Is there a way--using macros
> or VBA--to make this one dialog box work for multiple reports?  Thanks in
> advance!
msgulf - 25 Jan 2007 14:22 GMT
Thank you.  I will give this a try.

> Through macros?  Probably.
>
[quoted text clipped - 23 lines]
> > or VBA--to make this one dialog box work for multiple reports?  Thanks in
> > advance!
msgulf - 25 Jan 2007 15:44 GMT
Yes, I am confused.  I have a macro attached to the OK command button on my
form which opens a specific report with the specified date range.  If I use a
macro to open the form, how do I open a report?  In other words, how do I
program the OK button to work with any report since I have to specify a
report name using the OpenReport action?  

If macros are too simplistic for this, how can I code this using VBA?

> Through macros?  Probably.
>
[quoted text clipped - 23 lines]
> > or VBA--to make this one dialog box work for multiple reports?  Thanks in
> > advance!
chris.nebinger@gmail.com - 26 Jan 2007 18:30 GMT
On the line right above your OpenReport action, use a OpenForm action.
Set the Window Mode to Dialog.  This will cause the macro to pause
while the form is open.

On the OnClose event, use VBA code, and set the visibile property of
the form to false.  This hides the form, but leaves it open for your
query to access the values.  Once the form is hidden, the macro runs
the next line, which opens the report.  The recordsource of the report
is the query with the conditions set, which evaluate to find the form
you have hidden, and enters those values.

After the report open action, you should close the form that has the
date ranges with a standard Close action.

Does that help?

Chris

> Yes, I am confused.  I have a macro attached to the OK command button on my
> form which opens a specific report with the specified date range.  If I use a
[quoted text clipped - 32 lines]
> > > or VBA--to make this one dialog box work for multiple reports?  Thanks in
> > > advance!- Hide quoted text -- Show quoted text -
msgulf - 29 Jan 2007 14:12 GMT
Yes it does; thank you!

> On the line right above your OpenReport action, use a OpenForm action.
> Set the Window Mode to Dialog.  This will cause the macro to pause
[quoted text clipped - 50 lines]
> > > > or VBA--to make this one dialog box work for multiple reports?  Thanks in
> > > > advance!- Hide quoted text -- Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.