My message box is working great. HOWEVER, in the "Else" section, I have an OkCancel button. In testing, both buttons close the message box and move on to send the data to the URL I can't figure out how to just close the box and stop the code if the user selects the "Cancel" button.
Code:
Private Sub btn_iplookup_Click()
'Check to see if IP field contains data
If IsNull(Me.IP) Then
'Let user know it will not perform the check without IP.
MsgBox "No IP Address Found !" & _
vbCrLf & "Please add IP address and check again.", vbOKOnly Or VbMsgBoxStyle.vbExclamation, _
"IP Address Error"
Else
'Notify user that they will be leaving the application to check IP Geo Info
MsgBox "NOTE: This will output to your browser", vbOKCancel Or VbMsgBoxStyle.vbExclamation, _
"Notice"
Me.btn_iplookup.HyperlinkAddress = "http://freegeoip.net/?q=" & Me.IP
Me.btn_iplookup.Hyperlink.Follow True
Me.btn_iplookup.HyperlinkAddress = ""
End If
End Sub