E
efandango
I need to exclude any Postcode which has the Value "X" from the resultant
recordset output by the code below:
I want to say, if any postcodes field contains the single value of 'X', then
don't include it in the output data: How do I add this optional clause?
The Code:
***************
'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 & " 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
***************
recordset output by the code below:
I want to say, if any postcodes field contains the single value of 'X', then
don't include it in the output data: How do I add this optional clause?
The Code:
***************
'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 & " 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
***************