"Captured" URL from data fields

A

Antonio

I would like to create a button with a pre-defined URL
address, but that would also use data from a record. I am
trying to put a button on the form that would verify a
customer's address via mapquest. So, there would be a pre-
defined string for the www.mapquest.com but I need it
to "capture" the Address, City, State, and Zip from the
record to include in the URL. Hope this is clear. Does
anyone has an idea? Thanks, Antonio
 
C

Cheryl Fischer

Antonio,

First, enter an address into the MapQuest address fields and click the
Search button. Then, copy the entire URL and paste it somewhere so that you
can look at it.

For example, if you were searching for:

601 Travis
Houston, TX 77002

the complete URL would look like the following:

http://www.mapquest.com/maps/map.adp?country=US&addtohistory=&address=601+Tr
avis&city=Houston&state=TX&zipcode=77002&homesubmit=Get+Map

The first line, "http://www.mapquest.com/maps/map.adp?" is fixed so it
needs no change. For the address, you will need to use your field values to
construct a string that looks just like the rest of the URL:

"country=US&addtohistory=&address=601+Travis&city=Houston&state=TX&zipcode=7
7002&homesubmit=Get+Map"

Then, you can use the following (untested) to get to the map page:

Dim strLinkPath as string
Dim strExtra as string

strLinkPath = "http://www.mapquest.com/maps/map.adp?"
strExtraInfo = ' string with your search values

Application.FollowHyperlink Address:=strLinkPath, extrainfo:=strExtra,
NewWindow:=True

The above has worked fine for me in an application where the users have to
select a single state and go to that particular page on a multi-state site.

hth,
 
A

Antonio

Thank you Cheryl. Questions: what about the break up of
the address, like street number and street name? In
mapquest URL there is a "+" sign in between.
Antonio
 
C

Cheryl Fischer

Well, that appears to be what MapQuest requires, so I think you may have to
do it their way. You may also want to experiment a little bit yourself by
editing the URL of a search to replace the + with a space and see what
MapQuest returns.

Otherwise, you could do a couple of things:

- If going to MapQuest is an important part of the functionality of the
database, you may want to consider splitting your Address field into two
fields: AddrNumber and StreetName.

- If you cannot do that, then you would need to parse your address to
separate street number and street name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top