Connecting Tech Pros Worldwide Forums | Help | Site Map

Interactive Parameters

DAF LAD's Avatar
Newbie
 
Join Date: Oct 2006
Location: England, UK
Posts: 8
#1: Mar 9 '08
Hi All,

I have a dtatbase that stores alot of data. I have a query that brings back all the data that i need for the reports I need to produce. These reports that I produce are organised by date. I currently have a parameter set up so that when the report is run the default message box appears asking you to enter the date for the report. This will then bring back only the results that refer to that date.

However if you enter an incorrect date then the report will show nothing.

I would like to create a form that has a dropdown combo box (that list all the selectable dates from a table i already have) that when a value is selected that is the answer to the query parameter and the report is produced.

I have read the "help file" on microsofts website, that was not much help at all. I have also read a few forums explaining how to use interactive parameter forms but have had no success.

Can anyone give me any hints/help??

The query is named "qry_ASA" and the parameter value is for the field "Gala"
The form I would like to use is named "frm_GalaSelection" and the combo box name is "Gala"

Thanks in advance

ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,224
#2: Mar 9 '08

re: Interactive Parameters


Quote:

Originally Posted by DAF LAD

Hi All,

I have a dtatbase that stores alot of data. I have a query that brings back all the data that i need for the reports I need to produce. These reports that I produce are organised by date. I currently have a parameter set up so that when the report is run the default message box appears asking you to enter the date for the report. This will then bring back only the results that refer to that date.

However if you enter an incorrect date then the report will show nothing.

I would like to create a form that has a dropdown combo box (that list all the selectable dates from a table i already have) that when a value is selected that is the answer to the query parameter and the report is produced.

I have read the "help file" on microsofts website, that was not much help at all. I have also read a few forums explaining how to use interactive parameter forms but have had no success.

Can anyone give me any hints/help??

The query is named "qry_ASA" and the parameter value is for the field "Gala"
The form I would like to use is named "frm_GalaSelection" and the combo box name is "Gala"

Thanks in advance

  1. In qry_ASA, in the [Gala] Field, type this in the Criteria Row:
    Expand|Select|Wrap|Line Numbers
    1. Forms!frm_GalaSelection![Gala]
  2. Assuming your Report is named Report1, make sure its Record Source is set to qry_ASA.
  3. In the AfterUpdate() Event of the Gala Combo Box, place the following code:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Gala_AfterUpdate()
    2.   If Not IsNull(Me![Gala]) Then
    3.     DoCmd.OpenReport "<Your Report Name>", acViewPreview, , , acWindowNormal
    4.   End If
    5. End Sub
  4. You can also specify the Criteria in the OpenReport Line itself, and not in qry_ASA:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Gala_AfterUpdate()
    2.   If Not IsNull(Me![Gala]) Then
    3.     DoCmd.OpenReport "Report1", acViewPreview, , "[Gala] = #" & Me![Gala] & "#"
    4.   End If
    5. End Sub
DAF LAD's Avatar
Newbie
 
Join Date: Oct 2006
Location: England, UK
Posts: 8
#3: Mar 10 '08

re: Interactive Parameters


thanks, works perfectly
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,224
#4: Mar 10 '08

re: Interactive Parameters


Quote:

Originally Posted by DAF LAD

thanks, works perfectly

You are quite welcome.
Reply


Similar Microsoft Access / VBA bytes