Hi,
I'm trying to set a textbox control in a form (Me.Assignee_Email_Address) to a value returned from this function (temp_Email).
When I run this code the function is returning the value I want (based on the msgbox commands) but I am getting a runtime error 424 on the line "Set Me.Assignee_Email.Address.Value..."
Any assistance would be greatly appreciated.
Thanks.
Amyn Visram
-----------------------------------------------------------
Private Sub Assigned_Individual_LostFocus()
Dim temp_Email As String
temp_Email = ReturnEmail(Nz(Me.Assigned_Individual))
Set Me.Assignee_Email_Address.Value = temp_Email
End Sub
Function ReturnEmail(Ass_Ind As String)
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.Open "Select * from SHR:Users"
Do Until rst.EOF
If rst![Full Name] = Ass_Ind Then
MsgBox rst![Full Name]
MsgBox rst![Email Address]
ReturnEmail = rst![Email Address]
End If
rst.MoveNext
Loop
End Function
I'm trying to set a textbox control in a form (Me.Assignee_Email_Address) to a value returned from this function (temp_Email).
When I run this code the function is returning the value I want (based on the msgbox commands) but I am getting a runtime error 424 on the line "Set Me.Assignee_Email.Address.Value..."
Any assistance would be greatly appreciated.
Thanks.
Amyn Visram
-----------------------------------------------------------
Private Sub Assigned_Individual_LostFocus()
Dim temp_Email As String
temp_Email = ReturnEmail(Nz(Me.Assigned_Individual))
Set Me.Assignee_Email_Address.Value = temp_Email
End Sub
Function ReturnEmail(Ass_Ind As String)
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.Open "Select * from SHR:Users"
Do Until rst.EOF
If rst![Full Name] = Ass_Ind Then
MsgBox rst![Full Name]
MsgBox rst![Email Address]
ReturnEmail = rst![Email Address]
End If
rst.MoveNext
Loop
End Function