John Williams
New member
- Local time
- Today, 19:26
- Joined
- Apr 2, 2010
- Messages
- 8
I have created a form that I want to save and print the current form.
Print works ok but I get an error when clicking the save button. The error is:
An expression you entered is the wrong data type for one of the arguments.
This is my code. I have tried looking at various web site and access help but cannot find the answer

Private Sub cmdPrintRecord_Click()
Dim strReportName As String
Dim strCriteria As String
strReportName = "rptPrintRecord"
strCriteria = "[TRAMMS]='" & Me![TRAMMS] & "'"
DoCmd.OpenReport strReportName, acViewNormal, , strCriteria
Exit_rptPrintRecord_Click:
Exit Sub
Err_rptPrintRecord_Click:
MsgBox Err.Description
Resume Exit_rptPrintRecord_Click
End Sub
Private Sub cmdOutputRecord_Click()
On Error GoTo Err_cmdOutputRecord_Click
Dim strRecordName As String
Dim strCriteria As String
strRecordName = "rptSaveReport"
strCriteria = "[TRAMMS]='" & Me![TRAMMS] & "'"
DoCmd.OutputTo acOutputForm, strRecordName, strCriteria, acFormatHTML, "C:\Desktop\General\DOA\DOA.html", True
Exit_cmdOutputRecord_Click:
Exit Sub
Err_cmdOutputRecord_Click:
MsgBox Err.Description
Resume Exit_cmdOutputRecord_Click
End Sub
Print works ok but I get an error when clicking the save button. The error is:
An expression you entered is the wrong data type for one of the arguments.
This is my code. I have tried looking at various web site and access help but cannot find the answer

Private Sub cmdPrintRecord_Click()
Dim strReportName As String
Dim strCriteria As String
strReportName = "rptPrintRecord"
strCriteria = "[TRAMMS]='" & Me![TRAMMS] & "'"
DoCmd.OpenReport strReportName, acViewNormal, , strCriteria
Exit_rptPrintRecord_Click:
Exit Sub
Err_rptPrintRecord_Click:
MsgBox Err.Description
Resume Exit_rptPrintRecord_Click
End Sub
Private Sub cmdOutputRecord_Click()
On Error GoTo Err_cmdOutputRecord_Click
Dim strRecordName As String
Dim strCriteria As String
strRecordName = "rptSaveReport"
strCriteria = "[TRAMMS]='" & Me![TRAMMS] & "'"
DoCmd.OutputTo acOutputForm, strRecordName, strCriteria, acFormatHTML, "C:\Desktop\General\DOA\DOA.html", True
Exit_cmdOutputRecord_Click:
Exit Sub
Err_cmdOutputRecord_Click:
MsgBox Err.Description
Resume Exit_cmdOutputRecord_Click
End Sub