Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Parameter Queries help 1

Status
Not open for further replies.

Lostsouljer

Technical User
Jan 23, 2006
9
0
0
NZ
I Have created a report that is obtaining its parameters from a form, which in turn then runs a query, the problem i am having is that after you enter the parameters into the form (a start date and end date), two text boxes pop up asking you to enter the startdate and enddate for the query (which is exactly the same as what has just been entered for the form. I can see the query has already been run from the parameters from the form as it pops up in the background with all the appropriate information, yet it is still asking me to re enter in the parameters) What am i doing wrong??Below is the code that i got off the Microsoft website help.

This is the code i am using for the query

Between [Forms]![Sort by workshop date]![StartDate] And [Sort by workshop date]![EndDate]


This is the code for the Form

Private Sub cmdOk_Click()

Me.Visible = False
DoCmd.OpenQuery "Appointments period", acViewNormal, acEdit
DoCmd.Close acForm, "Sort by workshop date"
End Sub



and this is in the report

Private Sub Report_Close()
DoCmd.Close acForm, "Sort by workshop date"
End Sub

Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True

' Open Sales By Category Dialog
DoCmd.OpenForm "Sort by workshop date", , , , , acDialog

' Cancel Report if User Clicked the Cancel Button
' If IsLoaded("Sort by workshop date") = False Then Cancel = True

' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub



Any help would be greatly appreciated
 
Why are you including these two lines of code:
Code:
  DoCmd.OpenQuery "Appointments period", acViewNormal, acEdit
  DoCmd.Close acForm, "Sort by workshop date"

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
The article first talks about opening a query and later talks about opening a report. I don't think the author meant for you to open the query if all you want is to open the report. Just comment out the two lines I asked about and run your application.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
I have tried what you suggested. It still opens the form to let me input the paramaters but i then get this pop up box asking for the parameters again?? Im at a loss to what is wrong. Thank you for your help so far though

Brendon

error.jpg
 
I dont know how to edit posts in this forum but the writing in that box is part of my query (it has two pop up boxes, one for the start date and one for the end date)
 
What is your relevant code? Are you closing the form anywhere? If so, comment out the code.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top