I am running in a really troubled situation with a bound access split. My form is bound to query that is linked to the SQL database.
I have a way that is called by some form controls on the "click" event:
private function UpdateCheckBoxCaption (ByRef p_label as label, p_fieldName string as string = "" as an alternative p_newStatus) in as Boolean UpdateCheckBoxCaption = false dim errCount integer checks errCount = 0 ', the value already exists, it can not be overwritten DoesFieldContainData (Me.Recordset, p_fieldName) = False Selection of MsgBox T (_ & amp "Do you really want to set the date?"; VbCrLf & amp; "" _ & amp; vbCrLf & amp; "can only manager to undo this change." _, VbYesNo or vbExclamation or vbDefaultButton1, "confirm") Me.Recordset .Edit error Goto errHandler (p_fieldName case vbYes with .Fields) now = .Update UpdateCheckBoxCaption = Select true episode ends with vbNo end other MsgBox "this date already set Was done "& amp; Use the Me.Recordset.Fields (p_fieldName) end function if errHandler: errCount = errCount + 1 if Err.Number = 3197 then debug it. Print "Error number"; ErrCount if errCount & lt; 10 Restart the end if end if the MsgBox "Error in UpdateCheckBoxCaption" end function
This is confused because I can simply add the original "error handling" (using this word from the loose The reason may be to start the problem because it is not really good to deal with the error) and start the problem with resume
. I can also put a breakpoint at .
Edit
Row and step on code without any error.
After more digging, it seems that the DoesFieldContainData function is actually causing problems here. If I delete that call, then the method works fine.
Which is why I believe that the method here does not "release" the RecordsSet is due to something like this about Restart
. The
Here's my DoesFieldContainData method (which is separate modules):
public function DoesFieldContainData (p_rs DAO.Recordset, as well as p_fieldName string ByRef) Boolean 'returns "true" if the field is valid data "returns" false "if the field is either null or" error "Goto errHandler DoesFieldContainData = truth IsNull (the p_rs form. fields (p_fieldName)) = If this is true then DoesFieldContainData = false end then p_rs.Fields (p_fieldName) = "" then DoesFieldContainData = false end if the exit session errHandler: DoesFieldContainData = False End Function
onClick seem like events:
private sub lbl_chk_concept2Review_Click () UpdateCheckBoxCaption Me.Controls ( "lbl_chk_concept2Review"), "DateConceptReviewHeld2" End Sub
I do not understand why this is also causing a 3197 record lock problem - am I missing?
The sequence of events is:
- Move the record to a new record in the split form
- Click on a label
- "On_Click"
- This call
UpdateCheckBoxCaption
immediately - This is code execution
- This is an "error" debug Print with
- Repeat the above step on a different label
- At all subsequent steps, debug statement fire at least once ( Sometimes twice)
In the best form A. I can tell myself, when you set breakpoints on all methods, any other code On_Current
method, which is the first time I go up twice record and line.
It does not appear in the loop, so it seems that you only pass through the function once Are there. The "restart" does not fix the problem, it only runs to the next line and continues on its way.
This problem can be because you are not p_rs shutting down. Make sure you close that record set before exiting.
Comments
Post a Comment