Bmelville1
Registered User.
- Local time
- Today, 07:10
- Joined
- Jun 18, 2012
- Messages
- 10
Hello,
I have a db that tracks issues at work. and I have created an email function is there a way that I can call it from 2 different forms and then add If Then statements to change parts based on which form calls it? I tried setting a variable called NewOld to say if it was a new issue or an update issue. because they use different reports as the email body. I get an error that says "object required" and my Set NewOLD is highlighted.
My FuncEmailTech works I then put if then statements like below in it
'Create Subject line of email based on old or new issue
If NewOld = 1 Then
StrSub = [Forms]![NewIssue]![Summary]
EmailSub = "An Issue Log has been opened: " & StrSub
Else
StrSub = [Forms]![Issues2]![Summary]
EmailSub = "An Issue Log has been Updated: " & StrSub
End If
I think I am not declaring the right type of variable but I don't know what to do should I use a boolean or string instead of an integer?
Thanks for your help
Brian
I have a db that tracks issues at work. and I have created an email function is there a way that I can call it from 2 different forms and then add If Then statements to change parts based on which form calls it? I tried setting a variable called NewOld to say if it was a new issue or an update issue. because they use different reports as the email body. I get an error that says "object required" and my Set NewOLD is highlighted.
Code:
Option Compare Database
Option Explicit
Dim NewOld As Integer
Dim TmpID As String
'This Function is for emailing newly created work orders out to the relevant individuals
Public Function FuncNewTechEmail()
Set NewOld = 1
TmpID = [Forms]![NewIssue]![ID]
FuncEmailTech
End If
End Function
'This Function is for emailing Updated work orders out to the relevant individuals
Public Function FuncOldTechEmail()
'Dim TmpID As String
'Dim NewOld As Integer
TmpID = [Forms]![Issues2]![ID]
'Set NewOld = 0
FuncEmailTech
End Function
'This Function is for emailing Technicians
Public Function FuncEmailTech()
My FuncEmailTech works I then put if then statements like below in it
'Create Subject line of email based on old or new issue
If NewOld = 1 Then
StrSub = [Forms]![NewIssue]![Summary]
EmailSub = "An Issue Log has been opened: " & StrSub
Else
StrSub = [Forms]![Issues2]![Summary]
EmailSub = "An Issue Log has been Updated: " & StrSub
End If
I think I am not declaring the right type of variable but I don't know what to do should I use a boolean or string instead of an integer?
Thanks for your help
Brian