Assuming you have a command button or the equivalent
on your form plus a text-box or the equivalent in which
the user can specify optional parameters (arguments)
appropriate to the report, you can include the argument(s)
to the OpenReport in the OnClick event of your command
button.
Then, in the OnOpen sub of your report you can reference
the arguments in Me.OpenArgs. (Remember that OpenArgs
for Reports isn't supported until Access 2002 and later
versions.)
Bill
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:DEF38CFF-CC62-42E8...@microsoft.com...
> Hi! Please bear in mind that I am still learning the ropes in the Access
> worlds, so pardon my lack of terms. Here's my question. I want to create
> a
> forms which pulls up a report that I would have created already, but on
> the
> form I want to be able to have parameters so that when the report is
> pulled
> up, it is pulled up based on what I type in the parameter. How do I
> accomplish this? Please help, I need to get this done asap and I kindly
> thanks in advance!!
2) I created a report based on the query (qry0809Services). I named it
rptServices0809.
3) I created a form with 3 combo boxes (EDA, School, Serivce) and I have 2
unbound text (Start Date) and (End Date). Then I titled all my combo boxes
as needed. Now.. this is where I am not sure if I did this part correctly, I
clicked on the Command Button, which requires me to choose category and
actions, which I do not want to do, so I clicked on Cancel, and I still have
a command button on the form. So then, I went to properties, and changed the
caption of the command button to OK. Then I clicked on the Event Procedure
and clicked on the Code Builder and typed:
Private Sub cboOK_Click()
Me.Visible = False
End Sub
Then I saved my form as frmParameterTesting
4) I went back to the qry0809Services and typed all the criteria as needed
(i.e. forms!frmParameterTesting!cboFindEDA,
forms!frmParameterTesting!cboFindSchool,
forms!frmParameterTesting!cboFindService, and Between
forms!frmParameterTesting!StartDate and forms!frmParameterTesting!EndDate
5) Now I went back to the report (rptServices0809) and coded the report for
the On Open Event and Close Event. For the Open Event, I typed in
DoCmc.OpenForm, "frmParameterTesting",,,,,acDialog and for the Close Event I
typed in DoCmd.Close acForm, "frmParameterTesting".
Wheeeewww..... nowwww... I closed the report after saving it.
6) I reopen the rptServices0809 (now I see to command buttons, the Open
Form and Close Form, which initially I created the OK button, but that
disappeared I don't know whether or not the Open and Close Form appears
because I coded that on the report , anyways.... I selected what I wanted and
typed in the date range I wanted. Once I click on the Open Form button, it
said:
"The report name ‘rptParameterTesting” you entered in either the property
sheet or macro is misspelled or refers o a report that doesn’t exit.
If the invalid report name is in a macro, an Action Failed dialog box will
display the macro name and the macro’s arguments after you click OK. Open
the Macro window, and enter the correct report name."
PLEASEEEEEEEE HELLLLLPPPPP.... I've Tried doing this twice.... and still no
output of the report!!! Please help me Please, I'm dying of exhaustion in
trying to figure this out...... crying.... Any help is highly appreciated....
Thanks Bill!!
Private Sub MyCmdButton_Click()
Dim strWhereExp as String
'Test to be sure date fields not blank (not verified for format)
If Len(Me.StartDate & "") > 0 AND Len(Me.EndDate & "") > 0 Then
strWhereExp = "MyStartDateField >= " & Me.StartDate _
"AND MyEndDateField <= " & Me.EndDate
DoCmd.OpenReport "rpt0809Services",acPreview,,strWhereExp
End If
End Sub
Is this what you're trying to accomplish?
Bill
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:059E8F1D-A75A-40A2...@microsoft.com...
Bill
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:BDD610D7-1E27-4F67...@microsoft.com...
You'll need to check the value of each combo control
before appending the added specification to the WHERE
clause, as I posted yesterday.
(Mani, I've not shown any argument checking to our
discussion here, but you need to add some code that
insures that there are valid values added to the WHERE
clause and handle the errors accordingly.)
strWhereExp = "MyStartDateField >= " & Me.StartDate _
"AND MyEndDateField <= " & Me.EndDate _
"AND my school stuff
here.............................. _
"AND my service stuff here
Bill
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:DE4BFE26-4EC3-4D15...@microsoft.com...
The "Enter Parameter Value" popup occurs whenever you
have a reference to a object that is not included in the current
form or report. Most likely, your code is making a reference
to StartDate and/or EndDate, but those two objects are not
present in the current form or report.
I'm beginning to get the idea that, in general, the difficulty you
are having might be attributed to an un-normalized database.
If you're not familiar with that concept, have a look at item "3"
at site: http://www.accessmvp.com/strive4peace/. There's some
solid information there that might be of great help to you when
you create an Access application.
Bill
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:2FC0F396-2B56-4E18...@microsoft.com...
How big is your mdb file? First, Click on Tools -> Database Utilities
-> Compact and Repair Database, then look at the size of the mdb
file using Windows Explorer. If you're having such horrendous problems,
you might want to zip the mdb and send it to me so I can have a look
at what might be causing you so much grief.
Where in the world are you? Your posting times seem to be quite a
bit different than where I am on the west coast of the USA.
Bill
bill no space stanton at psln dot com
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:EE444439-D2D1-4DE1...@microsoft.com...
Private Sub Report_Close()
DoCmd.close acForm, "frmServices0809Parameter"
End Sub
Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "frmServices0809Parameter", , , , , acDialog
End Sub
And here are the codes to my form:
Private Sub Cancel_Click()
DoCmd.close
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
I hope this will help. I highly appreciate your help. Thanks in advance
again!!
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:F46BB167-FFCA-4CB7...@microsoft.com...
Mani, I always like to encourage folks in the learning
process and with you also. However, my sense is that
you have a application design and database structure
that is giving you more fits than one would ordinarily
expect. My offer to examine your application and
database still stands, the confidential nature of the data
notwithstanding..............I do that all the time.
Bill
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:3828A64B-9A82-4AAF...@microsoft.com...
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:5CB85DA7-D10B-4B4A...@microsoft.com...
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:5CB85DA7-D10B-4B4A...@microsoft.com...
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:DC7F8D8E-A6CC-4BFE...@microsoft.com...
> Hi Bill! I've managed to figure out what I needed to do with the forms
> and
> reports with parameters. I've attached a module to the form, so that the
> form would close without having pop up parameters. All that is working
> great! However, now that I've attached a module, for some reason my
> switchboard is not working properly. When I click on the Switchboard
> manager
> to edit items and what not, I get this message: Run-time error '6467':
> The
> expression you entered is referred to an object that is closed or doesn't
> exist.
>
> Here's the code for my module:
> Option Compare Database
> Public bInReportOpenEvent As Boolean ' Is report in the Open event?
>
> Function IsNull(ByVal strFormName As String) As Boolean
> ' Returns True if the specified form is open in Form view or
> ' Datasheet view.
> Dim oAccessObject As AccessObject
> Set oAccessObject = CurrentProject.AllForms(strFormName)
> If oAccessObject.IsLoaded Then
> If oAccessObject.CurrentView <> acCurViewDesign Then
> IsNull = True
> End If
> End If
> End Function
>
> Is there something with the module that's why my switchboard isn't working
> properly?? Please help!! Thanks in advance....
Public Function MyIsNull(ByVal strFormName As String) As Boolean
....
....
MyIsNull = True
....
End Function
And, of course, where ever you've referenced
the function.
Bill
"Mani" <Ma...@discussions.microsoft.com> wrote in message
news:B17D681B-EA77-4745...@microsoft.com...
> Hi Bill! I finally figured out by looking at examples and such to make my
> parameter form close without the parameter value window popping up. So
> all
> that is working fine after attaching modules to the form. However, now my
> switchboard is not woking after I have implemented this task. When I
> clicked
> the Switchboard manager and tried to edit items there is a message that
> pops
> up as follows:
>
> Run-time error '2467': The expression you entered refers to an object
> that
> is closed or doesn't exist.
>
> And then it gives me option to debug.... This was what that was
> highlighted:
>
> Set oAccessObject = CurrentProject.AllForms(strFormName)
>
> Here are the codes for my module to the parameter form:
>
>
> Option Compare Database
> Public bInReportOpenEvent As Boolean ' Is report in the Open event?
>
> Function IsNull(ByVal strFormName As String) As Boolean
> ' Returns True if the specified form is open in Form view or
> ' Datasheet view.
> Dim oAccessObject As AccessObject
> Set oAccessObject = CurrentProject.AllForms(strFormName)
> If oAccessObject.IsLoaded Then
> If oAccessObject.CurrentView <> acCurViewDesign Then
> IsNull = True
> End If
> End If
> End Function
>
> So it seems to me there is something wrong with the coding in the module.
> Unless you think it's something else. Please help me.. Thanks in
> advance!!
> Looking forward to hearing from ya!
>