email report

  • Thread starter Thread starter wildalex2
  • Start date Start date
W

wildalex2

Guest
The below code shows how to select which report from a listed form . On the from the reports are listed inside a text box to choose which form to print, preview or email. I am having trouble with email, my errors are, "type mismatch" or error "2103". Any other suggestions, please.

TO EMAIL:
Private Sub SendReports_Click()
Dim X As Variant
For Each X In ReportList.ItemsSelected
Dim stDocName As String

stDocName = "ReportList.ItemsSelected(X)"
DoCmd.SendObject acReport, stDocName

Exit_SendReports_Click:
Next
End Sub



TO PREVIEW:
Private Sub ViewReports_Click()
Dim X As Variant
For Each X In ReportList.ItemsSelected
On Error GoTo MyErr
DoCmd.OpenReport ReportList.ItemData(X), acViewPreview
MyExit:
Exit Sub
MyErr:
If Err.Number <> 2501 Then
MsgBox Err.Description
End If
Resume MyExit
Next
End Sub

TO PRINT:
Private Sub PrintReports_Click()
Dim X As Variant
For Each X In ReportList.ItemsSelected
On Error GoTo MyErr
DoCmd.OpenReport ReportList.ItemData(X), acViewNormal
MyExit:
Exit Sub
MyErr:
If Err.Number <> 2501 Then
MsgBox Err.Description
End If
Resume MyExit
Next
End Sub


The list box is source like, SELECT [msysobjects].[Name] FROM msysobjects WHERE ((([msysobjects].[Type])=-32764));
 
Cosmo75, Do you still have the sample?

The link on this old thread is broken. Could you reprost your solution?

Ta in advance.
 

Users who are viewing this thread

Back
Top Bottom