Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Problem with ADO Connection
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 · ·