J
JNariss
Hello,
I am trying to include some fields into my emails using the SendObject
and creating a recordset to find the values to include into the
SendObject. However I keep getting the error:
Can't find the form 'Move Request' referred to in a macro expression or
visual basic code.
So here's the code I am trying to use:
Private Sub Submit_Click()
On Error GoTo Err_Submit_Click
Dim strRequest_ID As String
Dim strDate As String
Dim strAuthorized_By As String
Dim strMessage As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT * From [Move Request] WHERE [Move
#]" & " = " & Forms![Move Request]![Request ID])
strMove_# = rst![Move #]
strRequest_ID = Me.Request_ID
strDate = Me.Date
strAuthorized_By = Me.Authorized_By
strMessage = "The following Request has been submitted for production.
For more information regarding this request please go to the database
at \\egsrosintra1\d$\Database\SystemChangeRequest.mdb " & Chr$(13) &
Chr$(13) & _
"Request ID: " & strRequest_ID & Chr$(13) & Chr$(13) & _
"Move #: " & strMove_# & Chr$(13) & Chr$(13) & _
"Date: " & strDate & Chr(13) & Chr(13) & _
"Authorized By: " & strAuthorized_By & Chr(13) & Chr(13) & Chr(13) &
Chr(13) & _
"Please do not reply to this automated email."
DoCmd.SendObject acSendNoObject, , , "(e-mail address removed)", , ,
"Submit To Production", strMessage, No, False
DoCmd.GoToRecord , , acNewRec
DoCmd.Close acForm, "Submit To Production", acSaveYes
MsgBox "You have successfully submitted your request for production",
vbOKOnly
Err_Submit_Click:
MsgBox Err.Description
Resume Exit_Submit_Click
End Sub
NOW.........here is what I want to do:
The form this code is coming out of is called Submit To Production.
This form only has 3 fields:
1. Request ID
2. Date
3. Authorized By
However...When the form gets submitted I would like it to find the
matching Move # which is in my other table called "Move Request".
However this Move # has to match up with the Request ID number entered
in the Submit To Production form. I thought by somehow using the
recordset code I could make that happen. But I'm obviously doing
something incorrect.
I am trying to include some fields into my emails using the SendObject
and creating a recordset to find the values to include into the
SendObject. However I keep getting the error:
Can't find the form 'Move Request' referred to in a macro expression or
visual basic code.
So here's the code I am trying to use:
Private Sub Submit_Click()
On Error GoTo Err_Submit_Click
Dim strRequest_ID As String
Dim strDate As String
Dim strAuthorized_By As String
Dim strMessage As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT * From [Move Request] WHERE [Move
#]" & " = " & Forms![Move Request]![Request ID])
strMove_# = rst![Move #]
strRequest_ID = Me.Request_ID
strDate = Me.Date
strAuthorized_By = Me.Authorized_By
strMessage = "The following Request has been submitted for production.
For more information regarding this request please go to the database
at \\egsrosintra1\d$\Database\SystemChangeRequest.mdb " & Chr$(13) &
Chr$(13) & _
"Request ID: " & strRequest_ID & Chr$(13) & Chr$(13) & _
"Move #: " & strMove_# & Chr$(13) & Chr$(13) & _
"Date: " & strDate & Chr(13) & Chr(13) & _
"Authorized By: " & strAuthorized_By & Chr(13) & Chr(13) & Chr(13) &
Chr(13) & _
"Please do not reply to this automated email."
DoCmd.SendObject acSendNoObject, , , "(e-mail address removed)", , ,
"Submit To Production", strMessage, No, False
DoCmd.GoToRecord , , acNewRec
DoCmd.Close acForm, "Submit To Production", acSaveYes
MsgBox "You have successfully submitted your request for production",
vbOKOnly
Err_Submit_Click:
MsgBox Err.Description
Resume Exit_Submit_Click
End Sub
NOW.........here is what I want to do:
The form this code is coming out of is called Submit To Production.
This form only has 3 fields:
1. Request ID
2. Date
3. Authorized By
However...When the form gets submitted I would like it to find the
matching Move # which is in my other table called "Move Request".
However this Move # has to match up with the Request ID number entered
in the Submit To Production form. I thought by somehow using the
recordset code I could make that happen. But I'm obviously doing
something incorrect.