I have created a payroll program using visual basic 6.0, and appear to be having a problem with one of my ADO commands.
The program takes information from Employee hours and compares it to approved client hours. To do this I must query and compare information from two databases, billing and payroll DBs. Things are working ok, but I am getting a strange error code
run-time error 3219
Operation is not allowed in this context.
If Val(DateDay) <= 531 And Val(DateDay) >= 516 Then
BM2000MAY2.Find "ClientNumber =" & clinum
If BM2000MAY2.EOF = False Then
ResetClientHours = BM2000MAY2.Fields("WrkHours").Value
BM2000MAY2.Fields("WrkHours").Value = ResetClientHours - ResetProvHours
If BM2000MAY2.Fields("WrkHours").Value < 0 Then
BM2000MAY2.Fields("WrkHours").Value = 0
BM2000MAY2.Close '<--- this is where the error points to
The program will not allow me to close the recordset after the search.
If I remove it, I get the error message here.
'checking for instance of open recordset, if open it will close it
If BM2000MAY2.State = adStateOpen Then
BM2000MAY2.Close '<--- this is where I get the message now
'setting cursor and open information for recordset table
.ActiveConnection = BillingDB
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = "select * from BM2000MAY2 order by ClientNumber"
I don't understand why I can't close the recordset. I have made the recorset function on a public module, and only call it out instead of coding it throught the entire program. As I open and close it in many areas.
Please someone help me.
0 · ·