This is a basic email request which will create and email based on the Email Id field entered on the form frmFormName.
DoCmd.SendObject , "", "", [Forms]![frmFormName]![EMail Id], "", "", "", "", True, ""
I use the below to capture the users details and this then runs a query to update a usage table. This can then be cross referenced and their e-mail address used.
DoCmd.SetWarnings False
Dim oNet, oComp As Object
Set oNet = CreateObject("WScript.Network")
Set oComp = CreateObject("WScript.Network")
UserName = oNet.UserName
ComputerName = oComp.ComputerName
DoCmd.SetWarnings True
Then this used to send their details to you;
DoCmd.SetWarnings False
On Error GoTo cmdEmail_Err
DoCmd.SendObject , "", "", "You@yourdesk.com", "", "", [UserName] & " is a user of " & [Version], "Your computer number = ", True
MsgBox "E-mail has now been sent. Thank you", vbOKOnly, "Sent"
cmdEmail_Exit:
Exit Sub
cmdEmail_Err:
MsgBox "You cancelled and did not send the email", vbExclamation
Resume cmdEmail_Exit
DoCmd.SetWarnings True
Hopefully you can update this to you your own requirements. Good luck.
Dlookup also for your ref.
If (Not IsNull([NINO])) Then
If (Not IsNull(DLookup("[NINO]", "Advisor", "[NINO] ='" & Me!NINO & "'"))) Then
MsgBox "NINO has been verified.", vbOKOnly, "Verification"
Else
If MsgBox("Please check the NINO field - unable to verify against Advisor record", vbOKOnly, "Advisor table check") = vbOK Then
DoCmd.GoToControl "loans"
DoCmd.GoToControl "NINO"
End If
End If
End If
I know some people don't like placing their code on here, but hey, if it helps you out?!
