joelindquist
MIS
I've got a form field (Email) which will not always contain a value. I need to use this field to generate a hyperlink in VBA. It works fine when it contains a value, but when it has no value (No Email address) it pops up an error dialog. I've tried the Access VB reference, and find nothing to test if an expression has a value. Here is my code so far:
Private Sub Form_Open(Cancel As Integer)
Dim Address As String
If (Me.Email.Value = "*" Then
Address = "mailto:" + Me.Email.Value
Else
Address = "mailtoefault@hotmail.com"
End If
Me.sendmail.HyperlinkAddress = Address
End Sub
I'm used to PERL where you just say if ($Email), but alas, this doesn't work in VBA.
Thanks, Joe
Private Sub Form_Open(Cancel As Integer)
Dim Address As String
If (Me.Email.Value = "*" Then
Address = "mailto:" + Me.Email.Value
Else
Address = "mailtoefault@hotmail.com"
End If
Me.sendmail.HyperlinkAddress = Address
End Sub
I'm used to PERL where you just say if ($Email), but alas, this doesn't work in VBA.
Thanks, Joe