Answer was a work-around solution.
The solution settled on requires a look at the code and is a little
long but the basic code follows. It also involves setting up 4 new
fields in the table and a Command Button on the form.
Good Luck and Thanks again.
Private Sub cmdMakeHot_Click()
'this will make the ControlSource of the Email & Web Address textboxes
for "fldEmailText"
'and "fldWebText" change to "fldMailTo" and "fldURL"
Dim db As Database '
Dim rsCustomers As Recordset
Dim strSQL As String
Dim strConstruct As String
'Make the textboxes HYPERLINK
If Me!cmdMakeHot.Caption = "Make Text" Then ' Does the button
say "Make Text"?
Me!cmdMakeHot.Caption = "Make Hot" ' make the caption
say "Make Hot"
Me!cmdMakeHot.ForeColor = 16744448 ' make the text blue
Me!txtEmailAddress.ForeColor = 0 ' make the text black
Me!txtWebAddress.ForeColor = 0 ' make the text black
Me!txtEmailAddress.ControlSource = "fldEmailAddress" ' Yes, the
make the control source the Text field
Me!txtWebAddress.ControlSource = "fldWebAddress" ' make the
control source the Text field
Me!cmdMakeHot.ControlTipText = "Change Text field to Hyperlink to
initiate Email or Web Browser" ' Change the Tool Tip
Else 'Make the textboxes HOT ' No, the button says
"Make Hot", so
Me!cmdMakeHot.Caption = "Make Text" ' make the caption
say "Make Text"
Me!cmdMakeHot.ForeColor = 0 ' make the text
black
Me!txtEmailAddress.ForeColor = 16744448 ' make the text
blue
Me!txtWebAddress.ForeColor = 16744448 ' make the text
blue
Me!cmdMakeHot.ControlTipText = "Change Hyperlink field to Text for
editing" ' Change the Tool Tip
'now put the addresses into the HOT fields
Set db = CurrentDb ' set the database
object
strSQL = "SELECT * FROM tblClientInformation WHERE
[tblClientInformation]![ClientCompanyName] = '" & Me!ClientCompanyName
& "';"
Set rsCustomers = db.OpenRecordset(strSQL) ' set the recordset
object
'Do the Email first
' if the string begins with "#MailTo:" Then
If Left(Me!txtEmailAddress, 8) = "#MailTo:" Then
If Right(Me!txtEmailAddress, 1) = "#" Then
strConstruct = Me!txtEmailAddress
Else
strConstruct = Me!txtEmailAddress & "#"
End If
' if the string begins with "MailTo:" Then
ElseIf Left(Me!txtEmailAddress, 7) = "MailTo:" Then ' if the
string begins with "MailTo:" Then
If Right(Me!txtEmailAddress, 1) = "#" Then
strConstruct = "#" & Me!txtEmailAddress
Else
strConstruct = "#" & Me!txtEmailAddress & "#"
End If
' if the string does not begin with "#MailTo:" or "MailTo:" Then
Else
If Right(Me!txtEmailAddress, 1) = "#" Then
strConstruct = "#MailTo:" & Me!txtEmailAddress
Else
strConstruct = "#MailTo:" & Me!txtEmailAddress & "#"
End If
End If
rsCustomers.Edit
rsCustomers!fldMailTo = Nz(strConstruct, "")
rsCustomers.Update
'CurrentDb.Execute ("UPDATE [Customer Locations] SET [Customer
Locations].[fldEmailAddress] = '" & Nz(Me!txtEmailAddress, "") & "'
WHERE [Customer Locations].[CustKey] = '" & ClientCompanyName & "';")
'CurrentDb.Execute ("UPDATE [Customer Locations] SET [Customer
Locations].[fldMailTo] = '" & Nz(strConstruct, "") & "' WHERE
[Customer Locations].[CustKey] = '" & ClientCompanyName & "';")
'Do the Web second 'rsCustomers!fldWebAddress
Me!txtWebAddress
' if the string begins with "#Http://" Then
If Left(Me!txtWebAddress, 8) = "#Http://" Then
If Right(Me!txtWebAddress, 1) = "#" Then
strConstruct = Me!txtWebAddress
Else
strConstruct = Me!txtWebAddress & "#"
End If
' if the string begins with "Http://" Then
ElseIf Left(Me!txtWebAddress, 7) = "Http://" Then ' if the
string begins with "MailTo:" Then
If Right(Me!txtWebAddress, 1) = "#" Then
strConstruct = "#" & Me!txtWebAddress
Else
strConstruct = "#" & Me!txtWebAddress & "#"
End If
' if the string does not begin with "#Http://" or "Http://" Then
Else
If Right(Me!txtWebAddress, 1) = "#" Then
strConstruct = "#Http://" & Me!txtWebAddress
Else
strConstruct = "#Http://" & Me!txtWebAddress & "#"
End If
End If
rsCustomers.Edit
rsCustomers!fldURL = Nz(strConstruct, "")
rsCustomers.Update
rsCustomers.Close
Set rsCustomers = Nothing
Set db = Nothing
'change the controlsource to look at the TEXT fields
Stop
Me!txtEmailAddress.ControlSource = "fldMailTo" ' make the
control source HOT
Me!txtWebAddress.ControlSource = "fldURL" ' make the control
source HOT
End If
'Me.Refresh
End Sub
Private Sub txtEmailAddress_Exit(Cancel As Integer)
If Nz(Me!txtEmailAddress, "") <> "" Then Me!cmdMakeHot.Enabled =
True
Me.Refresh
End Sub
Private Sub txtWebAddress_Exit(Cancel As Integer)
If Nz(Me!txtWebAddress, "") <> "" Then Me!cmdMakeHot.Enabled =
True
Me.Refresh
End Sub
|