Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset Update

Status
Not open for further replies.

mans

Programmer
Mar 18, 2000
136
AU
Hello,

I am using the AddNew (eg. Adodc3.Recordset.AddNew) and Update (eg. Adodc3.Recordset.Update) methods to add a new record to my database. At the moment if somebody accidently clicks the update command before the AddNew command the program shut down (Run Time Error). What code can I use in an IF Then statement in the Update command to say that "Unless the AddNew command has been clicked first, do not update the database (record)".

Thank you
 
Why don't you just disable the update button until the user clicks the add button. That way there is no clicking update by mistake or until the add button is activated or until a user puts text in one of the data fields.


<---CuJo There are only two things universal in this world...'Hydrogen and Stupidity'
 
Disable the Update button until Addnew is clicked. Also use error trapping.
Code:
Dim lngErr as long
Dim strDescription as string
On Error Resume Next
     .... database cpmmand
     lngerr = Err.number
     if lngErr <> 0 then strDescription = Err.Description
On Error Goto 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top