Re: Need to stop form from going to first record

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Tofudisan" <TofuTheGreat@xxxxxxxxx> wrote in message
news:146bdd89-06cc-49d5-8014-7d25404b5e4f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The form is based off a query of the table. I've coded all the adds,
updates, and deletes to use either SQL or stored procedures so that I
can validate everything before I let it get into the back-end
database.

However I can quickly flip it over to being based off the table
directly if needed.


If you're going to manage all updates yourself, you really ought to be using
an unbound form. The reason I say that is that a bound Access form does
automatic updates for you IF you let it. There are two events you should
look at: BeforeInsert and BeforeUpdate. The first one fires just before a
new record is automatically inserted into the dataset. The second fires just
before a record that has been edited is inserted. Both events allow you to
cancel the auto-update by setting a variable called Cancel to True. Access
passes this variable to your procedure in the parameter list. So something
like:

If <ValidationFailedSomehow> Then
MsgBox "Cannot update the database because ... blah blah"
Cancel = True
End If

When this code executes, the user will be unable to 'move away' from the
current record until the problem is fixed (or they undo their changes).

Using a form in that manner is natural for Access and doesn't require any
further SQL or stored procedures in order to update your data.

Of course if you are using stored procedures for performance or security
reasons, then you may need to stick with that. If you do, make your form
unbound (clear its RecordSource property). If you leave it bound, your
record is being saved twice - once by your code and once by the form.


.



Relevant Pages

  • Re: A new proof of the superiority of set oriented approaches: numerical/time serie linear interpola
    ... a database as a collection of facts. ... database modifications as inserts, updates and deletes. ... The induction of a 3VL through NULL simply ... breaks that principle because once neither can validate the ...
    (comp.databases.theory)
  • Re: Records lost in an ADOStoredProc
    ... Use a thread to fire off the stored procedures so that your application ... Let's suppose it updates ... > the CacheSize is set to 1; it is worse when I increase the CacheSize. ... > I don't need to show records, only to execute the store procedure. ...
    (borland.public.delphi.database.ado)
  • Encrypted SQL Deployment
    ... The stored procedures and logic are all encrypted but we need to ... send schema updates and stored proc updates all the time. ... ENCRYPTION? ... profile) the update script? ...
    (microsoft.public.sqlserver.setup)
  • Any good, free tools for writing simple stored procedures?
    ... to interact with simple stored procedures used ... for inserts, updates, etc. ... the creation of standard stored procs. ...
    (microsoft.public.sqlserver)
  • Re: Searching stored procedures
    ... This article could use a few updates, but it should get the point across. ... "Ken Briscoe" wrote in message ... I have a database with a billion stored ... > stored procedures themselves ...
    (microsoft.public.sqlserver.programming)