MS Access VBA code to launch Cyberhomes valuation...

Hi.
I need to have a button which will open the Cyberhomes.com website with the property information drawn from my form's controls.
The controls are: Address1, City, State, Zip

The code below works to launch the Google map, but I don't know how to modify it to launch the Cyberhomes valuation...

Thanks!
Private Sub Label41_Click()
     On Error Resume Next
     Me.Refresh
     Access.FollowHyperlink "http://www.google.com/maps?q=" & _
                Replace(Me.Address1.Value, " ", "+") & "+" & _
                Replace(Me.City.Value, " ", "+") & "+" & _
                Replace(Me.State.Value, " ", "+") & "+" & _
                Replace(Me.Zip.Value, " ", "+") & "&sa=X&oi=map&ct=title"
End Sub

Open in new window

Slicer58Asked:
Who is Participating?
 
Chuck WoodConnect With a Mentor Commented:
Sure, I will be glad to do that.

Private Sub Label30_Click()
    On Error Resume Next
    Me.Refresh
    Access.FollowHyperlink _
        "http://cyberhomes.com/searchredirect.aspx?" & _
        "address=" & Me.Address1.Value & _
        "&city=" & Me.City.Value & _
        "&state=" & Me.State.Value & _
        "&zip=" & Me.Zip.Value & ""
End Sub

Open in new window

0
 
Chuck WoodCommented:
Replace the http link in the line below with the URL (Universal Resource Locator) for the Cyberhomes web site.

"http://www.google.com/maps?q=
0
 
Slicer58Author Commented:
Already tried that because it was so very obvious.  Didn't work.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
Chuck WoodCommented:
Does the Cyberhome site work like Google maps, that is does it accept address + city + state + ZIP in the URL?
0
 
Slicer58Author Commented:
I believe it's more complex than that, although I can see the address in the URL.  It would make more sense to you if you actually visited the site and then tried the code out yourself.
0
 
Chuck WoodCommented:
I would do that but unfortunately my corporate firewall won't let me. Can you post an example of the URL that works?
0
 
Slicer58Author Commented:
Here are two URLs from the site:
http://www.cyberhomes.com/homes-tustin-ca-92782/2947playerln/61214815.aspx
http://www.cyberhomes.com/homes-eastorange-nj-07017/160glenwoodave/10371460.aspx

Below is (I believe) an HTTP Post that works from our CRM.  Not sure how it would be translated into a VBA expression for Access 2007:  
http://cyberhomes.com/searchredirect.aspx?address={prop_street}&city={prop_city}&state={prop_state}


0
 
Chuck WoodCommented:
You might want to try something like this:

Private Sub Label41_Click()
     Dim strStreet As String, astrAddress() As String
     Dim intAddr As Integer
     ' split the address on spaces
     astrAddress = Split(Me.Address1.Value, " ")
     ' if the first part of the address is numeric
     If IsNumeric(astrAddress(0)) Then
        ' loop through the remaining parts of the address
        For intAddr = 1 To UBound(astrAddress, 1)
            ' add this part to the street
            strStreet = astrAddress(intAddr) & " "
        Next intAddr
     Else
        ' loop through all parts of the address
        For intAddr = 0 To UBound(astrAddress, 1)
            ' add this part to the street
            strStreet = astrAddress(intAddr) & " "
        Next intAddr
     End If
     strStreet = Trim(strStreet)
     On Error Resume Next
     Me.Refresh
    Access.FollowHyperlink "http://cyberhomes.com/searchredirect.aspx?address={" & _
        strStreet & "}&city={" & Me.City.Value & "}&state={" & Me.State.Value & "}"
End Sub

Open in new window

0
 
Slicer58Author Commented:
Thanks for going to all that trouble.  I tried it and kept getting error messages where it didn't recognize the fields.  I took out the brackets and that worked for the city and state, but it didn't recognize the street data.  So I pared it down to the following and it works fine.  My only question now is, can you help me split this code into the easy to read lines (I'm not sure where to put the ampersands and quotes).


Private Sub Label30_Click()
     On Error Resume Next
     Me.Refresh
    Access.FollowHyperlink "http://cyberhomes.com/searchredirect.aspx?address=" & Me.Address1.Value & "&city=" & Me.City.Value & "&state=" & Me.State.Value & "&zip=" & Me.Zip.Value & ""
End Sub
0
 
Slicer58Author Commented:
Thanks for your help!
0
 
Chuck WoodCommented:
You are very welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.