Parameter query used twice.

R

Robin Chapple

On a daily, sometimes twice a day, I need to print a hard copy of a
report and to have an RTF copy to email to others.

A parameter query is used to select the recent entries. Using the code
below I am asked to enter the start ID number twice, Is there a way
that this can be done from one entry?

Thanks,

Robin Chapple


Private Sub cmdAuditNewEntries_Click()
On Error GoTo Err_cmdAuditNewEntries_Click

Dim stDocName As String

stDocName = "rptRecentNewMembers"
DoCmd.OpenReport stDocName, acPrint
DoCmd.OutputTo acReport, "rptRecentNewMembers",
"RichTextFormat(*.rtf)", "D:\###\" & "rptRecentNewMembers,RTF", True,
"", 0
MsgBox "Successfully exported D:\###\" & "rptRecentNewMembers.RTF"

Exit_cmdAuditNewEntries_Click:
Exit Sub

Err_cmdAuditNewEntries_Click:
MsgBox Err.Description
Resume Exit_cmdAuditNewEntries_Click

End Sub
 
V

Van T. Dinh

Add an unbound TextBox on your Form and ask your users to enter the StartID
there. You can then use the full reference to the Control as the Parameter
in your Query and Access will pick up the value automatically for OpenReport
and OutputTo statements.
 

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