Hi,
I'm pretty new to Access & vba so thanks in advance.
I have written the following code but get Run-time error '3061': Too few parameters. Expected 1.
The "Top 10 Closest" is a query within the database.
Hope I made sense, thanks for any help.
Jord
I'm pretty new to Access & vba so thanks in advance.
I have written the following code but get Run-time error '3061': Too few parameters. Expected 1.
Code:
Private Sub Command257_Click()
Dim dbsMyMap As DAO.Database
Dim rstPositions As DAO.Recordset
Dim strURLBeg As String
Dim strURLEnd As String
Dim strMyURL As String
Dim strURL As String
Set dbsMyMap = CurrentDb()
Set rstPositions = dbsMyMap.OpenRecordset("Top10 Closest")
If rstPositions.EOF Then Exit Sub
strMyURL = ""
With rstPositions
Do Until .EOF
MyLat = rstPositions![CUSTLAT]
MyLong = rstPositions![CUSTLONG]
strMyURL = strMyURL & "+to:" & MyLat & "," & MyLong
.MoveNext
Loop
End With
strURLBeg = "http://maps.google.co.uk/maps?saddr="
strURLEnd = "&t=m&doflg=ptk"
strURL = URLBeg & MyURL & URLEnd
Debug.Print "URL would be: " & strURL
dbsMyMap.Close
rstPositions.Close
Set dbsMyMap = Nothing
Set rstPositions = Nothing
End Sub
The "Top 10 Closest" is a query within the database.
Hope I made sense, thanks for any help.
Jord