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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I only want to print one account

Status
Not open for further replies.

hext2003

Technical User
Oct 9, 2006
119
US
I created a report (not with a query and after reading a bunch on here I think I should have done that first)

Anyway, I just linked to tables and I have the report making a page break so each account number is on a separate page. Looks nice I am happy with that but...

Is there a search feature so I can type in the account number I want to print rather than paging through to the account and printing that page?

Is there a way to do it with the way I have it set up or should I scrap what I have and start over??
 
Create a form [frmRptCriteria] and add a combo box [cboAccountNum]. Run the command button wizard to create a command button that opens your report. Then find and change the wizard's code to something like:

Code:
Dim stDocument as String
Dim strWhere as String
stDocument = "rptYourReportName"
strWhere = "1=1 "
If not IsNull(Me.cboAccountNum) Then
   'assuming acctnumfield is text
   strWhere = strWhere & " AND [AcctNumField] =""" & _
       Me.cboAccountNum & """"
End If
DoCmd.OpenReport stDocument, acPreview, , strWhere
If the account number field is numeric, then use
Code:
   strWhere = strWhere & " AND [AcctNumField] =" & _
       Me.cboAccountNum


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