report after parameter form

C

ChrisC

Hi,

in my database I have a parameter query from which the result is shown in a
form. The parameter is Like "*" & [Enter name or part of name: ] & "*".
I would like to have a button on the form, giving me the report of the query
result.

Searching the internet I noticed that parameter query should best be avoided
and replaced with the Where-statement. But I have no idea how to replace my
parameter query with this.
So in fact there are two questions:
- replacement of parameter query by Where-statement
- how to get a report based on the parameter or Where.

Thanks for any help.
Chris
 
R

Richard

Chris


Set your report's record source to your parameter query. Then make a new
command button to open the report. Should work just fine.

Richard
 
C

ChrisC

Richard,
I tried that before but then I have to reenter my parameter and that's what
I'm trying to avoid.
This is the situation:
query = qryProductName
parameter = Like "*" & [Enter name or part of name: ] & "*"
form (result of parameter query) = frmSearchProduct / record source =
qryProductName
report = rptSearchProduct / record source = qryProductName
button on frmSearchProduct =
Private Sub Knop11_Click()
On Error GoTo Err_Knop11_Click

Dim stDocName As String

stDocName = "rptSearchProduct"
DoCmd.OpenReport stDocName, acPreview

Exit_Knop11_Click:
Exit Sub

Err_Knop11_Click:
MsgBox Err.Description
Resume Exit_Knop11_Click

End Sub

What do I have to change to get the filtered result of my frmSearchProduct
directly on my rptSearchProduct?

Chris

Richard said:
Chris


Set your report's record source to your parameter query. Then make a new
command button to open the report. Should work just fine.

Richard



ChrisC said:
Hi,

in my database I have a parameter query from which the result is shown in
a
form. The parameter is Like "*" & [Enter name or part of name: ] & "*".
I would like to have a button on the form, giving me the report of the
query
result.

Searching the internet I noticed that parameter query should best be
avoided
and replaced with the Where-statement. But I have no idea how to replace
my
parameter query with this.
So in fact there are two questions:
- replacement of parameter query by Where-statement
- how to get a report based on the parameter or Where.

Thanks for any help.
Chris
 
R

Richard

Chris

You could use a textbox to pass your "parameter" to your query then you wont
be prompted.

Like [Forms]![YourForm]![YourTextbox] & "*"

Then make the query your record source for your report.
Sorry I couldn't be more helpful.

Richard

ChrisC said:
Richard,
I tried that before but then I have to reenter my parameter and that's what
I'm trying to avoid.
This is the situation:
query = qryProductName
parameter = Like "*" & [Enter name or part of name: ] & "*"
form (result of parameter query) = frmSearchProduct / record source =
qryProductName
report = rptSearchProduct / record source = qryProductName
button on frmSearchProduct =
Private Sub Knop11_Click()
On Error GoTo Err_Knop11_Click

Dim stDocName As String

stDocName = "rptSearchProduct"
DoCmd.OpenReport stDocName, acPreview

Exit_Knop11_Click:
Exit Sub

Err_Knop11_Click:
MsgBox Err.Description
Resume Exit_Knop11_Click

End Sub

What do I have to change to get the filtered result of my frmSearchProduct
directly on my rptSearchProduct?

Chris

Richard said:
Chris


Set your report's record source to your parameter query. Then make a new
command button to open the report. Should work just fine.

Richard



ChrisC said:
Hi,

in my database I have a parameter query from which the result is shown in
a
form. The parameter is Like "*" & [Enter name or part of name: ] & "*".
I would like to have a button on the form, giving me the report of the
query
result.

Searching the internet I noticed that parameter query should best be
avoided
and replaced with the Where-statement. But I have no idea how to replace
my
parameter query with this.
So in fact there are two questions:
- replacement of parameter query by Where-statement
- how to get a report based on the parameter or Where.

Thanks for any help.
Chris
 

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