hi, im creating a simple db and hit a prob, prob a simple answer but for some reason i cant figure it out, doh
i have a comobo box called comboGoToMark when i change the value in this box i want to change another value called MyGoogleMapURL which holds a url, the url has to include info from a table called tblMarks
i get the error " no value given for one or more required parameters"
am i going about this problem in the wrong way, any help appreciated as im fairly new to vba and sql etc
the code is below
Private Sub comboGoToMark_Change()
Dim dblglong As Double
Dim dblglat As Double
Dim strmarkname As String
Dim cnn1 As ADODB.Connection
Set cnn1 = CurrentProject.Connection
Dim myRecordSet As New ADODB.Recordset
myRecordSet.ActiveConnection = cnn1
Dim mySQL As String
mySQL = "SELECT tblMarks.tblMarkName, tblMarks.tblLat, tblMarks.tblLong"
mySQL = mySQL + " FROM tblMarks"
mySQL = mySQL + " WHERE (((tblgoogle.tblSettingName)=me.comboGoToMark))"
myRecordSet.Open mySQL
dblglong = myRecordSet.Fields("tblLong").Value
dblglat = myRecordSet.Fields("tblLat").Value
strmarkname = myRecordSet.Fields("tblMarkName").Value
myRecordSet.Close
Set myRecordSet = Nothing
Set cnn1 = Nothing
MyGoogleMapURL = "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=" + dblglat + "," + dblglong + "(" + strmarkname + ")"
End Sub
i have a comobo box called comboGoToMark when i change the value in this box i want to change another value called MyGoogleMapURL which holds a url, the url has to include info from a table called tblMarks
i get the error " no value given for one or more required parameters"
am i going about this problem in the wrong way, any help appreciated as im fairly new to vba and sql etc
the code is below
Private Sub comboGoToMark_Change()
Dim dblglong As Double
Dim dblglat As Double
Dim strmarkname As String
Dim cnn1 As ADODB.Connection
Set cnn1 = CurrentProject.Connection
Dim myRecordSet As New ADODB.Recordset
myRecordSet.ActiveConnection = cnn1
Dim mySQL As String
mySQL = "SELECT tblMarks.tblMarkName, tblMarks.tblLat, tblMarks.tblLong"
mySQL = mySQL + " FROM tblMarks"
mySQL = mySQL + " WHERE (((tblgoogle.tblSettingName)=me.comboGoToMark))"
myRecordSet.Open mySQL
dblglong = myRecordSet.Fields("tblLong").Value
dblglat = myRecordSet.Fields("tblLat").Value
strmarkname = myRecordSet.Fields("tblMarkName").Value
myRecordSet.Close
Set myRecordSet = Nothing
Set cnn1 = Nothing
MyGoogleMapURL = "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=" + dblglat + "," + dblglong + "(" + strmarkname + ")"
End Sub