Hi,
I just altered a query that was Previously working OK. I now get a data type mismatch error. The error occurs in the query with the 'AND' in the 'WHERE' clause
tblHolesDesignAndSurvey.IDStope data type is number.
Any help much appreciated
Thanks
I just altered a query that was Previously working OK. I now get a data type mismatch error. The error occurs in the query with the 'AND' in the 'WHERE' clause
tblHolesDesignAndSurvey.IDStope data type is number.
Any help much appreciated
Thanks
Code:
Sub DisseminateDesignData(STPName As String, sPath As String) 'separates and appends data to correct tables
Dim db As DAO.Database
Dim IDStope As Integer
Dim rst10 As DAO.Recordset
Dim strSQL10 As String
Set db = CurrentDb
db.Execute "INSERT INTO tblDesignStope (StopeName) VALUES (""" & STPName & """)"
db.Execute "INSERT INTO tblHolesDesignAndSurvey ( IDStope, VulcanHoleID, DesignOrSurvey) " & _
"SELECT tblDesignStope.IDStope, tblTmpHeader.holeid, tblTmpHeader.DesignOrSurvey " & _
"FROM tblDesignStope LEFT JOIN tblTmpHeader ON tblDesignStope.StopeName = tblTmpHeader.StopeName " & _
"WHERE (((tblDesignStope.StopeName)=""" & STPName & """))"
db.TableDefs.Refresh
Application.RefreshDatabaseWindow
strSQL10 = "SELECT tblDesignStope.IDStope " & _
"FROM tblDesignStope " & _
"WHERE (((tblDesignStope.StopeName)=""" & STPName & """))"
Set rst10 = db.OpenRecordset(strSQL10, dbOpenSnapshot)
IDStope = rst10(0)
'============PROBLEM HERE - DATA TYPE MISMATCH
db.Execute "INSERT INTO tblHoleCoordinates ( IDHole, Depth, Azimuth, Inclination, XCoordinate, YCoordinate, ZCoordinate) " & _
"SELECT tblHolesDesignAndSurvey.IDHole, tblTmpDesign.depth, tblTmpDesign.azimth, tblTmpDesign.inclin, tblTmpHeader.east, tblTmpHeader.north, tblTmpHeader.level " & _
"FROM (tblHolesDesignAndSurvey INNER JOIN tblTmpHeader ON tblHolesDesignAndSurvey.VulcanHoleID = tblTmpHeader.holeid) INNER JOIN tblTmpDesign ON tblHolesDesignAndSurvey.VulcanHoleID = tblTmpDesign.holeid " & _
"WHERE (((tblHolesDesignAndSurvey.DesignOrSurvey)= ""DESIGN"")) AND (((tblHolesDesignAndSurvey.IDStope)=""" & IDStope & """))"
db.TableDefs.Refresh
Application.RefreshDatabaseWindow
Set rst10 = Nothing
End Sub