I have the following code behind an A97 form. It worked fine in A2k but I keep getting a "Type Mismatch Error" with the following code. I commented out most of the lines and I keep getting the same error. I also tried moving the code to the On Load Event...no change. After commenting out line by line...It appears that it doesn't like "rstMax as Recordset". Any ideas?
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim dbsMain As Database
Dim rstMax As Recordset
Forms!frmDebitOdMain.Repaint
'Determine the latest data date for the default lookup
Set dbsMain = CurrentDb
Set rstMax = dbsMain.OpenRecordset("qryGetMaxDebitOdDate"
rstMax.MoveFirst
ASOF_Date = rstMax!Max_Trans_Date
Me.txtFromDate.Value = rstMax!Max_Trans_Date
Me.txtToDate.Value = rstMax!Max_Trans_Date
rstMax.Close
'Run the query to report on Overdrafts for the default date
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryGetDebitOdBaseDataMT", acViewNormal, acReadOnly
DoCmd.SetWarnings True
cmdGo_Click
Exit Sub
Err_Form_Open:
Select Case Err.Number
Case 3151
MsgBox "ERROR " + Trim(Str(Err.Number)) + ": " + Err.Description + Chr(13) + Chr(13) + "Cannot continue without ODBC connection. Aborting..."
Quit
Case Else
MsgBox "ERROR " + Trim(Str(Err.Number)) + ": " + Err.Description
Exit Sub
End Select
End Sub
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim dbsMain As Database
Dim rstMax As Recordset
Forms!frmDebitOdMain.Repaint
'Determine the latest data date for the default lookup
Set dbsMain = CurrentDb
Set rstMax = dbsMain.OpenRecordset("qryGetMaxDebitOdDate"
rstMax.MoveFirst
ASOF_Date = rstMax!Max_Trans_Date
Me.txtFromDate.Value = rstMax!Max_Trans_Date
Me.txtToDate.Value = rstMax!Max_Trans_Date
rstMax.Close
'Run the query to report on Overdrafts for the default date
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryGetDebitOdBaseDataMT", acViewNormal, acReadOnly
DoCmd.SetWarnings True
cmdGo_Click
Exit Sub
Err_Form_Open:
Select Case Err.Number
Case 3151
MsgBox "ERROR " + Trim(Str(Err.Number)) + ": " + Err.Description + Chr(13) + Chr(13) + "Cannot continue without ODBC connection. Aborting..."
Quit
Case Else
MsgBox "ERROR " + Trim(Str(Err.Number)) + ": " + Err.Description
Exit Sub
End Select
End Sub