I have a form control button that when pressed, parses the following seperate
address controls into a googlemaps browser box. At the moment the code
references the open form address controls; I now want to be able to reference
the controls via an underlying query. Can someone help me with the syntax
required to insert the query name into the button code?
My Exisitng Code:
Private Sub Create_RunRoute_Button_Click()
On Error GoTo Err_RunRoute_Button_Click
Dim stAppName As String
stAppName = "C:\Program Files\Internet Explorer\iexplore.exe
http://maps.google.co.uk/maps?f=q&hl=en&q=" & "from: " & Me.RunWaypoint_1 +
", London" & (" to: " + Me.RunWaypoint_2 + ", London") & (" to: " +
Me.RunWaypoint_3 + ", London")
Call Shell(stAppName, 1)
Exit_RunRoute_Button_Click:
Exit Sub
Err_RunRoute_Button_Click:
MsgBox Err.Description
Resume Exit_RunRoute_Button_Click
End Sub
Instead of on the form, via the Me. reference, I now want the code to find
the controls in the following query name:
'Google_Runmaker_Query'
So it would logically be like this: (which doesn't work syntax-wise)
stAppName = "C:\Program Files\Internet Explorer\iexplore.exe
http://maps.google.co.uk/maps?f=q&hl=en&q= Google_Runmaker_Query
" & "from: " & Me.RunWaypoint_1 + ", London" & (" to: " + Me.RunWaypoint_2 +
", London") & (" to: " + Me.RunWaypoint_3 + ", London")
efandango - 01 Jun 2007 00:28 GMT
I tried this adjustment to the code:
stAppName = "C:\Program Files\Internet Explorer\iexplore.exe
http://maps.google.co.uk/maps?f=q&hl=en&q=" & DLookup("RunWaypoint_1",
"Google_Runmaker_Query")
But it can only handle one field at a time, does anyone know how I can
yield/parse results from the other fields in my query?
RunWaypoint_2, RunWaypoint_3, RunWaypoint_1
and so on...
> I have a form control button that when pressed, parses the following seperate
> address controls into a googlemaps browser box. At the moment the code
[quoted text clipped - 37 lines]
> ", London") & (" to: " + Me.RunWaypoint_3 + ", London")
>
Marshall Barton - 01 Jun 2007 05:33 GMT
>I tried this adjustment to the code:
>
[quoted text clipped - 6 lines]
>
>RunWaypoint_2, RunWaypoint_3, RunWaypoint_1
I can not even pretend to understand what you are doing
here, but you can use DLookup the get mutilpe fields in the
result string:
. . . & DLookup("RunWaypoint_2 & "", "" & RunWaypoint_3 &
"", "" & RunWaypoint_1_1", "Google_Runmaker_Query")
Another way is open a recordset on the query and get the
values directly from the fields:
Dim db As Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Google_Runmaker_Query")
stAppName = " . . . " & rs!RunWaypoint_2 & ", " &
rs!RunWaypoint_3 & ", " & rs!RunWaypoint_1

Signature
Marsh
MVP [MS Access]
Chris2 - 01 Jun 2007 09:53 GMT
> I have a form control button that when pressed, parses the following seperate
> address controls into a googlemaps browser box. At the moment the code
[quoted text clipped - 36 lines]
> " & "from: " & Me.RunWaypoint_1 + ", London" & (" to: " + Me.RunWaypoint_2 +
> ", London") & (" to: " + Me.RunWaypoint_3 + ", London")
efandango,
Your question appears to be: "Can someone help me with the syntax
required to insert the query name into the button code?"
Your desire appears to be: "> Instead of on the form, via the Me.
reference, I now want the code to find the controls in the following
query name:"
This appears to me to mean two possible things to me.
1) You want the Query name to appear directly in the VBA code. If
this is so, I need more information about what you need in order to
assist you.
2) You want the Query to be executed by a click on the Form's button.
If #2 is correct, then:
On the button's On Click event property (property page, event tab),
put the name of the Sub, Google_Runmaker_Query.
When you click the button (while the Form is running), that should run
the Query you have designed.
The query can refer to controls on a Form using the following syntax:
[Forms]![YourFormName]![YourControlName]
Sincerely,
Chris O.
Chris2 - 01 Jun 2007 09:59 GMT
"Chris2" <rainofsteel.NOTVALID@GETRIDOF.luminousrain.com> wrote in
message ews:VYWdnVwdq-mkQ8LbnZ2dnUVZ_tGvnZ2d@comcast.com...
> On the button's On Click event property (property page, event tab),
> put the name of the Sub, Google_Runmaker_Query.
I wrote in Sub instead of Query. That should be:
On the button's On Click event property (property page, event tab),
put the name of the Query, Google_Runmaker_Query.
Sincerely,
Chris O.