Paul Cooke
Registered User.
- Local time
- Today, 23:40
- Joined
- Oct 12, 2001
- Messages
- 288
Hi guys I have a select case statement to send a report via print or email from the active form "AccidentOnly". I am having problems closing the form within it and would be very grateful for some advice on how to resolve this.
I need to place these two lines somewhere after the 'sendobject' command as if they close before it the report cannot pull the information of the form
code as follows
I have tried placing them in various areas of the statement but they do not close, although the email bit works fine and I am tottally lossed on this now !
Perhap I shouldn't be doing this on a Sunday morning with a hangover !!
Many thanks in advice for any advice offered
I need to place these two lines somewhere after the 'sendobject' command as if they close before it the report cannot pull the information of the form
Code:
DoCmd.Close acForm, "AccidentOnly", acSaveYes
DoCmd.Close acForm, "FindPatientAccident"
code as follows
Code:
Case 3 'Email
DoCmd.Close acForm, "ReportOptionsSinglePatientAccidentOnly"
DoCmd.OpenForm "Navigation"
On Error GoTo ErrorRoutine1
Const errUserCanceledAction As Long = 2501
DoCmd.SendObject acSendReport, "ARFOnSetAO", acFormatPDF, , , , "Patient Accident Form" _
, "Accident form is attached. Please treat this docuument as confidential." _
& vbCrLf & vbCrLf & "If you require further information or advice, please do not hesitate to contact us." & vbCrLf & vbCrLf & vbCrLf & "On Set Medical Support Services" _
RoutineExit1:
Exit Sub
ErrorRoutine1:
If Err.Number = errUserCanceledAction Then
'Do nothing
Else
MsgBox "Error number: " & Err.Number & vbCrLf & vbCrLf & _
Err.Description, vbCritical, "Error"
End If
Resume RoutineExit1
End Select
I have tried placing them in various areas of the statement but they do not close, although the email bit works fine and I am tottally lossed on this now !
Perhap I shouldn't be doing this on a Sunday morning with a hangover !!
Many thanks in advice for any advice offered