my subform relies on a table that needs to be refreshed each time the form is loaded. So Icreated this code to do just that:
<code>
Private Sub Form_Load()
On Error GoTo err_handler
DoCmd.SetWarnings False
DoCmd.RunSQL "DROP TABLE tbl_Checks_to_be_Claimed_Temp"
DoCmd.OpenQuery "mt_Checks_to-Be_Claimed"
Call ResetForm
DoCmd.SetWarnings True
Exit Sub
err_handler:
DoCmd.SetWarnings True
Select Case Err.Number
Case 3295
MsgBox ("Temp Table could not be dropped. All records may not be available")
Case Else
MsgBox ("Unexpected Error!" & vbCrLf & "Error Code: " & Err.Number & _
vbCrLf & Err.Description)
End Select
Exit Sub
</code>
I get the error at the drop table line.
I tried rebooting and making sure nothing opens upon opening the database. The subform recordsource is 'tbl_Checks_to_be_Claimed_Temp', but I am assuming the form_load event would run before the subform locks the table.
I have spent the last hour searching and trying different options but nothing seems resolve this error.
<code>
Private Sub Form_Load()
On Error GoTo err_handler
DoCmd.SetWarnings False
DoCmd.RunSQL "DROP TABLE tbl_Checks_to_be_Claimed_Temp"
DoCmd.OpenQuery "mt_Checks_to-Be_Claimed"
Call ResetForm
DoCmd.SetWarnings True
Exit Sub
err_handler:
DoCmd.SetWarnings True
Select Case Err.Number
Case 3295
MsgBox ("Temp Table could not be dropped. All records may not be available")
Case Else
MsgBox ("Unexpected Error!" & vbCrLf & "Error Code: " & Err.Number & _
vbCrLf & Err.Description)
End Select
Exit Sub
</code>
I get the error at the drop table line.
I tried rebooting and making sure nothing opens upon opening the database. The subform recordsource is 'tbl_Checks_to_be_Claimed_Temp', but I am assuming the form_load event would run before the subform locks the table.
I have spent the last hour searching and trying different options but nothing seems resolve this error.