[AccessD] Access Address to Map in Browser - LENGTHY REPLY

Bob Gajewski rbgajewski at adelphia.net
Tue Apr 27 10:47:16 CDT 2004


William:

I placed two command buttons (cmdMap and cmdWeather) on my form and
controlled their value, caption and enabled state through code. This also
uses a US zip code database to automatically populate the Municipality and
StateCode fields.


*********************************************
Private Sub Form_Current()
If IsNull([txtJobMunicipalityName]) Or _
    IsNull([txtJobStateCode]) Or _
    IsNull([txtJobZipCode]) Or _
    [txtJobMunicipalityName] = "" Or _
    [txtJobStateCode] = "" Or _
    [txtJobZipCode] = "" Then
    cmdMap.Enabled = False
    cmdMap.Caption = "Local map not available - address incomplete"
    cmdWeather.Enabled = False
    cmdWeather.Caption = "Local weather not available - address incomplete"
Else
    cmdMap.Enabled = True
    cmdWeather.Enabled = True
End If

If Not IsNull([txtJobZipCode]) And [txtJobZipCode] <> "" Then
    cmdMap.HyperlinkAddress =
"http://www.mapquest.com/maps/map.adp?country=US&addtohistory=&address=" &
[txtJobAddress] & "&city=" & [txtJobMunicipalityName] & "&state=" &
[txtJobStateCode] & "&zipcode=" & [txtJobZipCode] &
"&homesubmit.x=30&homesubmit.y=14"
    cmdMap.Caption = "View local map for " & [txtJobMunicipalityName] & ", "
& [txtJobStateCode]
    cmdWeather.HyperlinkAddress = "http://www.weather.com/weather/local/" &
[txtJobZipCode] & "?whatprefs="
    cmdWeather.Caption = "Check local weather in " &
[txtJobMunicipalityName] & ", " & [txtJobStateCode]
End If
End Sub
*********************************************
Private Sub txtJobMunicipalityName_AfterUpdate()
If IsNull([txtJobStateCode]) Or [txtJobStateCode] = "" Then
    Me.txtJobStateCode.SetFocus
End If
If IsNull([txtJobMunicipalityName]) Or _
    IsNull([txtJobStateCode]) Or _
    IsNull([txtJobZipCode]) Or _
    [txtJobMunicipalityName] = "" Or _
    [txtJobStateCode] = "" Or _
    [txtJobZipCode] = "" Then
    cmdMap.Enabled = False
    cmdMap.Caption = "Local map not available - address incomplete"
    cmdWeather.Enabled = False
    cmdWeather.Caption = "Local weather not available - address incomplete"
Else
    cmdMap.Enabled = True
    cmdWeather.Enabled = True
End If
End Sub
*********************************************
Private Sub txtJobStateCode_AfterUpdate()
If IsNull([txtJobMunicipalityName]) Or _
    IsNull([txtJobStateCode]) Or _
    IsNull([txtJobZipCode]) Or _
    [txtJobMunicipalityName] = "" Or _
    [txtJobStateCode] = "" Or _
    [txtJobZipCode] = "" Then
    cmdMap.Enabled = False
    cmdMap.Caption = "Local map not available - address incomplete"
    cmdWeather.Enabled = False
    cmdWeather.Caption = "Local weather not available - address incomplete"
Else
    cmdMap.Enabled = True
    cmdWeather.Enabled = True
End If
End Sub
*********************************************
Private Sub txtJobZipCode_AfterUpdate()
Dim varCMN, varCSC
varCMN = DLookup("[txtMunicipalityName]", "tblZipCodes",
"[tblZipCodes].[txtZipCode] = '" & [txtJobZipCode] & "'")
varCSC = DLookup("[txtStateCode]", "tblZipCodes",
"[tblZipCodes].[txtZipCode] = '" & [txtJobZipCode] & "'")
If Not IsNull(varCMN) Then
    Me.txtJobMunicipalityName = varCMN
    Me.txtJobStateCode = varCSC
Else
    MsgBox "The zip code entered is not on file. Input the municipality name
and select the state."
    Me.txtJobMunicipalityName = Null
    Me.txtJobStateCode = Null
    Me.txtJobMunicipalityName.SetFocus
End If
If IsNull([txtJobMunicipalityName]) Or _
    IsNull([txtJobStateCode]) Or _
    IsNull([txtJobZipCode]) Or _
    [txtJobMunicipalityName] = "" Or _
    [txtJobStateCode] = "" Or _
    [txtJobZipCode] = "" Then
    cmdMap.Enabled = False
    cmdMap.Caption = "Local map not available - address incomplete"
    cmdWeather.Enabled = False
    cmdWeather.Caption = "Local weather not available - address incomplete"
Else
    cmdMap.Enabled = True
    cmdWeather.Enabled = True
End If
If Not IsNull([txtJobZipCode]) And [txtJobZipCode] <> "" Then
    cmdMap.HyperlinkAddress =
"http://www.mapquest.com/maps/map.adp?country=US&addtohistory=&address=" &
[txtJobAddress] & "&city=" & [txtJobMunicipalityName] & "&state=" &
[txtJobStateCode] & "&zipcode=" & [txtJobZipCode] &
"&homesubmit.x=30&homesubmit.y=14"
    cmdMap.Caption = "View local map for " & [txtJobMunicipalityName] & ", "
& [txtJobStateCode]
    cmdWeather.HyperlinkAddress = "http://www.weather.com/weather/local/" &
[txtJobZipCode] & "?whatprefs="
    cmdWeather.Caption = "Check local weather in " &
[txtJobMunicipalityName] & ", " & [txtJobStateCode]
End If
End Sub
*********************************************



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of William
Hindman
Sent: Tuesday, April 27, 2004 06:52
To: Access Developers discussion and problem solving
Subject: [AccessD] Access Address to Map in Browser


Group

...in Outlook, I can  open a map of a contact's address in a browser
directly from Outlook as follows:

a) select Contacts on the Outlook Bar or in the folder list.
b) select contact whose address I want to locate.
c) File/Open/Selected Items.
d) Under the Address button, click the arrow, and then click the type of
address I want to find on the map (Business/Home/Other).
e) Actions/Display Map of Address.

...my browser opens to Find a Map at mappoint.msn.com with a push-pin
marking the location of the address.

...has anyone done anything like this via code from Access? ...without using
Outlook?

William Hindman
"Always code as if the person who is maintaining or testing your code is
a violent psychopath who knows where you live." William Silverstein


--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list