I am running into a strange error with my database. Here is my code:
Dim Invoice_Table As DAO.Recordset
Set db = CurrentDb()
For i = 1 To tempnum
Set Invoice_Table = db.OpenRecordset(mysql_statement)
For j = 1 To tempnum2
invoicedamount = invoicedamount + Invoice_Table.fields("ActualAmount"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Next j
If (invoicedamount < quotedamount(i)) Then
MsgBox (error_msg)
End If
Invoice_Table.Close
Next i
Set Invoice_Table = Nothing
[/color]
The error message I am getting is: "Complie error: Type mismatch" and when I click "ok" on the error message box, "db.OpenRecordset" is highlighted, as if the error is only occuring in this statement. I don't think it's because of my sql statement because I think it would have highlighted the particular part of the sql statement that was having issues (I have the sql statement spelled out in my code, but didn't put that on here). I have used this recordset syntax before and haven't had any issues. Can anyone help me figure out what exactly is going on? Thanks!
Dim Invoice_Table As DAO.Recordset
Set db = CurrentDb()
For i = 1 To tempnum
Set Invoice_Table = db.OpenRecordset(mysql_statement)
For j = 1 To tempnum2
invoicedamount = invoicedamount + Invoice_Table.fields("ActualAmount"
Next j
If (invoicedamount < quotedamount(i)) Then
MsgBox (error_msg)
End If
Invoice_Table.Close
Next i
Set Invoice_Table = Nothing
[/color]
The error message I am getting is: "Complie error: Type mismatch" and when I click "ok" on the error message box, "db.OpenRecordset" is highlighted, as if the error is only occuring in this statement. I don't think it's because of my sql statement because I think it would have highlighted the particular part of the sql statement that was having issues (I have the sql statement spelled out in my code, but didn't put that on here). I have used this recordset syntax before and haven't had any issues. Can anyone help me figure out what exactly is going on? Thanks!