I have this code below that was given to me. However
Instead of entering the postal code continually or selecting from the combo box. How do I set zipcode 1 and zipcode 2 based on fields in a form. I would like to use the current FROM (Default zip based on the current job in form) and TO zipcode [Project Postal Code] that is on the form at that time. Not necessarily combo box.
Currently you have
zip1 = Me.Combo2.Value
zip2 = Me.Combo4.Value
I want Zip 1 to be Default zip (however I can still change it if needed)
ZipCode field is [Project Postal Code]
Can you help me? Not that savvy with replacing. code.
Thanks
Here is the full code:
Private Sub Command6_Click()
Dim zip1 As String, zip2 As String
Dim sResponse As String
Dim sLink As String
On Error GoTo Command6_Click_Error
zip1 = Me.Combo2.Value
zip2 = Me.Combo4.Value
Dim sHold As String
sHold = GetDistanceBetweenTwoZips(zip1, zip2)
MsgBox "The distance between " & zip1 & " and " & zip2 & " is " & Mid(sHold, 1, InStr(sHold, "|") - 1) _
& vbCrLf & " The estimated time to get there is " & Mid(sHold, InStr(sHold, "|") + 1)
sResponse = MsgBox("Do you want to see a map of the route?", vbYesNo, "Want a Map")
If sResponse = vbYes Then
sLink = "http://maps.google.com/maps?f=q&hl=en&q="
Application.FollowHyperlink sLink & zip1 & " to " & zip2
End If
On Error GoTo 0
Exit Sub
Command6_Click_Error:
If Err.Number = 94 Then
MsgBox "You must make zip selections before clicking the button"
Exit Sub
Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Command6_Click of VBA Document Form_frmZipSample"
End If
End Sub