C
charles.kendricks
I have a form which is used to input church visitor data. From this
form I want to be able to generate a welcome letter while still having
the input form open. In other words I want to put the visitor into the
database and generate the letter without closing the input form (which
updates the underlying table used for the visitor name and salutation
in the welcome letter). Here is the code I thought would work
Private Sub btnWelcomeLtr_Click()
On Error GoTo Err_btnWelcomeLtr_Click
Dim stDocName As String
Dim strCriteria As String
strCriteria = "[LastName]='" & Me![LastName] & "'" & " AND " &
"[Salutation]='" & Me![Salutation] & "'"
lngRecNum = Me![ID]
stDocName = "rptWelcomeLetter"
DoCmd.OpenReport stDocName, , , strCriteria
Debug.Print strCriteria
Exit_btnWelcomeLtr_Click:
Exit Sub
Err_btnWelcomeLtr_Click:
MsgBox Err.Description
Resume Exit_btnWelcomeLtr_Click
End Sub
I am only trying to include the Salutation and Last name in the letter
form I want to be able to generate a welcome letter while still having
the input form open. In other words I want to put the visitor into the
database and generate the letter without closing the input form (which
updates the underlying table used for the visitor name and salutation
in the welcome letter). Here is the code I thought would work
Private Sub btnWelcomeLtr_Click()
On Error GoTo Err_btnWelcomeLtr_Click
Dim stDocName As String
Dim strCriteria As String
strCriteria = "[LastName]='" & Me![LastName] & "'" & " AND " &
"[Salutation]='" & Me![Salutation] & "'"
lngRecNum = Me![ID]
stDocName = "rptWelcomeLetter"
DoCmd.OpenReport stDocName, , , strCriteria
Debug.Print strCriteria
Exit_btnWelcomeLtr_Click:
Exit Sub
Err_btnWelcomeLtr_Click:
MsgBox Err.Description
Resume Exit_btnWelcomeLtr_Click
End Sub
I am only trying to include the Salutation and Last name in the letter