INSERT or UPDATE Initialization

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

When you are using a form in Access, and you change a
field value or fill out the form for new record, how is
that change propagated in the database table. For
example, say that I have a text box field on a form where
a user can change the existing value or add a completely
new record. They user then opens the form, changes the
value in a field, then moves onto the next field. When
is the UPDATE executed (when the text field loses focus)
and by what (ODBC, OLE DB, Jet etc.)

Thanks Jim,
 
You are doubtless talking about a so-called "bound" form. In a bound form,
the RecordSource property of the form defines the table or query on which
the form is based. The ControlSource property of each control (eg. textbox)
defines the name of the field (in that table or query) to which that control
will be "bound". Access automatically adds records to, deletes records from,
and edits field values in, the specified fields of the specified table or
query, as the user performs those actions on the form. Access does this by
using DAO (internally) to communicate with jet, the underlying database
engine. It does not issue SQL commands for those purposes.

In an >unbound< form, the RecordSource and ControlSource properties are left
blank, so Access does >not< do anything automatically. You have to code the
various form & control events to make the changes explicitly. For that
purpose you could use DAO (just like Access does internally), or you could
issue SQL statements, & maybe other methods also.

As for >when< an edit is saved in a bound form: When you edit a field, the
record is marked as "dirty" (in memory) as soon as the focus leaves that
field. Then, if the record is dirty, Access saves the change (into the
database) when you try to exit that record; perhaps by closing the form, or
moving to a different record.

HTH,
TC
 
Back
Top