R
Ronald Dodge
Access 2002, SP2 on W2K Pro, SP4
DAO 3.6 (Variables declared to appropriate libraries to avoid ambiguities)
Forms UNBOUND (Mainly cause bound forms don't allow for mouse user
friendliness and strict data validation checks at the appropriate times at
the same time)
In my code, the DAO recordset is put into either Edit or AddNew mode
provided the validation had passed and the checks allows for it, which this
is done within my custom validation code. I have an Add/Update command
button on the form. At the time I press that command button after filling
in the fields, when it comes to the line:
drsRES.Fields("fldDSC").Value = Me.tbxDSC.Value
it errors out with the Run-time error code of 3020 and text of "Update or
CancelUpdate without AddNew or Edit." However, as I checked this out
further, the EditMode on the recordset at that same point of time is showing
a value of '2' (numeric form), which is the same as the constant, adEditAdd.
Given the above, why would I get the above error message, if the EditMode on
the recordset is indicating that it's in AddNew mode? All I can think of
doing at this point, setup a form level variable to indicate if the
recordset should be in edit, addnew, or none mode for updating purposes,
which then have the actual full updating take place all within the
Add/Update command button as it doesn't seem to bother the code that way.
DAO 3.6 (Variables declared to appropriate libraries to avoid ambiguities)
Forms UNBOUND (Mainly cause bound forms don't allow for mouse user
friendliness and strict data validation checks at the appropriate times at
the same time)
In my code, the DAO recordset is put into either Edit or AddNew mode
provided the validation had passed and the checks allows for it, which this
is done within my custom validation code. I have an Add/Update command
button on the form. At the time I press that command button after filling
in the fields, when it comes to the line:
drsRES.Fields("fldDSC").Value = Me.tbxDSC.Value
it errors out with the Run-time error code of 3020 and text of "Update or
CancelUpdate without AddNew or Edit." However, as I checked this out
further, the EditMode on the recordset at that same point of time is showing
a value of '2' (numeric form), which is the same as the constant, adEditAdd.
Given the above, why would I get the above error message, if the EditMode on
the recordset is indicating that it's in AddNew mode? All I can think of
doing at this point, setup a form level variable to indicate if the
recordset should be in edit, addnew, or none mode for updating purposes,
which then have the actual full updating take place all within the
Add/Update command button as it doesn't seem to bother the code that way.