Link to home
Start Free TrialLog in
Avatar of David_W_R
David_W_R

asked on

How to determine if a recordset is updatable

At the end of a procedure in which I rs.edit, when I close the rs, I need to know whether the rs has been written to, in order to determine whether to rs.update or not.  Otherwise, rs.update throws an error if the rs has not been altered.  Is there a test that determines this?
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Data is 'written' when ... the .Update method is executed.

What error are you getting and can you post the relevant code?

mx
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
<< when I close the rs, I need to know whether the rs has been written to, in order to determine whether to rs.update or not.>>

Are you trying to update after closing the recordset?

rs.close should come after the rs.Update.
Yes ... let me add the Close:


With CurrentDb.OpenRecordset("SomeDataSource", dbOpenDynaset)
    If .Updatable = False Then
        MsgBox " sorry no can do"
        Exit Function
    End If
    .Edit
    ' set values here
    .Update ' data is Written here.
    .Close ' **********
End With
Avatar of David_W_R
David_W_R

ASKER

Lots of help from both experts combined for a very effective solution.  Thanks for the quick response!