E
efandango
I want to be able to select any group of records on a continuous form using
the record selector and send the chosen records to an external web browser.
The code I have below will parses a set of records from a table to a web
browser, but I want to do it from a form, and be able to select from any
contiguous set of the displayed records.
How can I determine which is the the first, last and the in between records
and how do I pass them through to the browser? can someone advise on how I
can modify my existing code to do this?.
My form is called : Forms![frm_Runs]![frm_Run_Reveal_Target]
this is my exisiting code:
Private Sub btn_Run_Test_Show_Map_Click()
'Assume lngRunNo is either declared elsewhere or passed as an argument
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sRoute As String
Dim iWPCount As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("Select [Run_waypoint], [Postcode] from
tbl_Run_Reveal_Target where [Run_No]=" & Me.Run_No & " and [Postcode]<> 'X'
order by [OrderSeq];", dbOpenForwardOnly)
Do Until rs.EOF
iWPCount = iWPCount + 1
sRoute = sRoute & IIf(iWPCount = 1, "from: ", " to: ") &
rs![Run_waypoint] & ", " & "London, " & rs![Postcode]
rs.MoveNext
Loop
rs.Close
If iWPCount >= 2 Then
Parent.Form.Run_Test_WebBrowser.Navigate
"http://maps.google.co.uk/maps?f=q&hl=en&q=" & sRoute
Else
MsgBox "Run must have at least two waypoints"
End If
End Sub
the record selector and send the chosen records to an external web browser.
The code I have below will parses a set of records from a table to a web
browser, but I want to do it from a form, and be able to select from any
contiguous set of the displayed records.
How can I determine which is the the first, last and the in between records
and how do I pass them through to the browser? can someone advise on how I
can modify my existing code to do this?.
My form is called : Forms![frm_Runs]![frm_Run_Reveal_Target]
this is my exisiting code:
Private Sub btn_Run_Test_Show_Map_Click()
'Assume lngRunNo is either declared elsewhere or passed as an argument
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sRoute As String
Dim iWPCount As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("Select [Run_waypoint], [Postcode] from
tbl_Run_Reveal_Target where [Run_No]=" & Me.Run_No & " and [Postcode]<> 'X'
order by [OrderSeq];", dbOpenForwardOnly)
Do Until rs.EOF
iWPCount = iWPCount + 1
sRoute = sRoute & IIf(iWPCount = 1, "from: ", " to: ") &
rs![Run_waypoint] & ", " & "London, " & rs![Postcode]
rs.MoveNext
Loop
rs.Close
If iWPCount >= 2 Then
Parent.Form.Run_Test_WebBrowser.Navigate
"http://maps.google.co.uk/maps?f=q&hl=en&q=" & sRoute
Else
MsgBox "Run must have at least two waypoints"
End If
End Sub