Print Current Record

kaden

New member
Local time
Today, 13:23
Joined
Nov 25, 2008
Messages
2
Hi All!

I am experiencing a problem that I am hoping someone can shed some light on. I have used the Onclick event to print the current record of a form and the code works great for every parameter on the form except my unique identifier (which happens to be the ID - autonumber field). I have used this exact same code in another database to do the same thing without too much trouble however on the current database I keep getting the "Enter Parameter Value" dialogue box open when I execute.
It is asking for a user input instead of automatically using the value from the current open form.

As I have said I have tried using another (non-unique) field and the code works without activating the "Enter Parameter Value" prompt. I have also tried changing the name of the ID field with no avail. Below is the code, any chance someone here knows what I need to fix to get the code to automatically select the current record using the autonumber field?
Thanks in advance...

Private Sub CalculateResults_Click()
On Error GoTo Err_CalculateResults_Click

Dim strWhere As String
strWhere = "[ID]=" & Me!ID

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "DQCCResults", acPreview, , strWhere
DoCmd.PrintOut acPrintAll, , , acHigh, 1
DoCmd.SendObject acSendReport, , acFormatRTF, "Joe Smith", , , "DQCC Results",
, False
DoCmd.Close acReport, "DQCCResults", acSaveYes
DoCmd.Close acForm, "DQCCDataEntry", acSaveYes

Exit_CalculateResults_Click:
Exit Sub

Err_CalculateResults_Click:
MsgBox Err.Description
Resume Exit_CalculateResults_Click

End Sub
 
First thing is to check the correct name of your report. You call it

"DQCCResults"

in one place then

"DQCC Results"

elsewhere, with a space between DQCC and Results.
 

Users who are viewing this thread

Back
Top Bottom