Good evening, all. Thanks for taking a moment to review my situation.
I've created a form and code in a '97-2003 Access db that will export the data from a local table into into an Access 2010 database via an INSERT INTO SQL statment. Once the data has been exported, I need to retrieve the "Record" autonumber from the 2010 database to use in an email that's being sent from the '97-2003 database. This task is probably simpler than I know, but I'm not writing my code correctly. Here's the relevant code:
Code:
'-------Export the contents of tblHSGrievanceData to the Medicare Grievances back-end db
530 strSQL = "INSERT INTO tblHSGrievanceData IN 'R:\Account Management Team DO NOT DELETE!!!\Medicare\Admin\Medicare Grievances_BackEnd.accdb' " & vbCrLf & _
"SELECT * " & vbCrLf & _
"FROM tblHSGrievanceData;"
540 DoCmd.RunSQL strSQL
'-------Ensure the local tblHSGrievanceData is empty
'550 strSQL = "DELETE * " & vbCrLf & _
' "FROM tblHSGrievanceData;"
'560 DoCmd.RunSQL strSQL
561 Set db = CurrentDb()
562 strSQL = "SELECT tblHSGrievanceData.Record from tblHSGrievanceData IN 'R:\Account Management Team DO NOT DELETE!!!\Medicare\Admin\Medicare Grievances_BackEnd.accdb' " & vbCrLf & _
"WHERE (((tblHSGrievanceData.TDate)= Date()) AND ((tblHSGrievanceData.HealthSpringID)= '" & Me.txtID & "'));"
563 Set rsRecord = db.OpenRecordset(strSQL, dbOpenDynaset)
564 MsgBox rsRecord
The error that I'm getting is runtime error 13, type mismatch on line 563. Line 564 was just for myself to see if the code worked! I patterned lines 561 - 563 from information found at this web-site:
I appreciate any help that can be provided. Again, this is probably a relatively simple matter that I'm just not getting!
Make it a great day!