simple report question

  • Thread starter Thread starter bmdavis
  • Start date Start date
B

bmdavis

Hi,
I have created a button that calls up a REPORT in print preview. I
want to make sure this button only calls up the appropriate fields in
REPORT based on what the user enters after a USER PROMPT (i.e. it
should ask for "Last Name" before going to print preview). What's the
easiest way to do this?

Thanks.
 
What do you mean by "calls up the appropriate fields"? Is this for filtering
or are you trying to hide controls on your report?
 
Thanks for the quick reply... Sorry about that, my fault with
language. I want to call up a report with a button. However, after I
press this button, I went the form to be filtered by the text I enter
after a user prompt. So the actual report is always the same, I just
want it to display a few pages instead of ALL the pages of the report.
Does that help?
 
Apparently you want to be able to enter text into a text box on your form
and use it to filter the records returned in your report. I would allow the
command button wizard to create the DoCmd.OpenReport procedure for you. Then
add code like:

Dim strWhere as String
strWhere = "1=1 "
If not IsNull(Me.txtYourTextBox) Then
strWhere = strWhere & " and [YourTextField] = """ & _
Me.txtYourTextBox & """"
End If
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere
 

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

Back
Top