A
Afrosheen via AccessMonster.com
Thanks for taking the time to read this. What I'm trying to do is to create
an email form from the tblSupervisor. The fields I'm using is; Supervisor,
Email, AssistMan, and UnitMan.
In the form I have a combo box called cmboSupervisor. Once I click on the
name, in the After Update sub it puts the names of the AssistMan and UnitMan
in two text boxes from cmboSupervisor columns 3 & 4. This works ok.
Now once those name are in the text boxes I want each text box to look in the
Supervisor field and get the email address of each text box AssistMan and
UnitMan. But, if the AssistMan or UnitMan doesn't exist then there will be no
CC: What I have works but there's probably a better way to do it. I know it's
probably not the best coding and please don't laugh..
Private Sub cmboSupervisor_AfterUpdate()
txtAssist = Me.cmboSupervisor.Column(3)
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
rs.FindFirst "[Supervisor] = '" & Me.cmboSupervisor.Column(3) & "'"
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
strCC = Me.Email
MsgBox txtAssist & "--" & strCC
Else
MsgBox "No other matches found"
End If
rs.Close
Set rs = Nothing
txtUnit = Me!cmboSupervisor.Column(4)
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
rs.FindFirst "[Supervisor] = '" & Me.cmboSupervisor.Column(4) & "'"
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
strCC1 = Me.Email
Else
MsgBox "No other matches found"
End If
rs.Close
Set rs = Nothing
If strCC = "" Then
strCC = strCC1
Else
strCC = strCC & "," & strCC1
End If
MsgBox strCC
End Sub
Again, thanks for your help
an email form from the tblSupervisor. The fields I'm using is; Supervisor,
Email, AssistMan, and UnitMan.
In the form I have a combo box called cmboSupervisor. Once I click on the
name, in the After Update sub it puts the names of the AssistMan and UnitMan
in two text boxes from cmboSupervisor columns 3 & 4. This works ok.
Now once those name are in the text boxes I want each text box to look in the
Supervisor field and get the email address of each text box AssistMan and
UnitMan. But, if the AssistMan or UnitMan doesn't exist then there will be no
CC: What I have works but there's probably a better way to do it. I know it's
probably not the best coding and please don't laugh..
Private Sub cmboSupervisor_AfterUpdate()
txtAssist = Me.cmboSupervisor.Column(3)
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
rs.FindFirst "[Supervisor] = '" & Me.cmboSupervisor.Column(3) & "'"
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
strCC = Me.Email
MsgBox txtAssist & "--" & strCC
Else
MsgBox "No other matches found"
End If
rs.Close
Set rs = Nothing
txtUnit = Me!cmboSupervisor.Column(4)
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
rs.FindFirst "[Supervisor] = '" & Me.cmboSupervisor.Column(4) & "'"
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
strCC1 = Me.Email
Else
MsgBox "No other matches found"
End If
rs.Close
Set rs = Nothing
If strCC = "" Then
strCC = strCC1
Else
strCC = strCC & "," & strCC1
End If
MsgBox strCC
End Sub
Again, thanks for your help