Form based on Query(view) won't update

  • Thread starter Thread starter X-Men
  • Start date Start date
X

X-Men

I encountered a problem in my ADP project. As long as a form is based on a
query(view), no records on that form can be updated. Forms behave normally
if they are based directly on a table.
I think it's gotta be some control/system setting problems, but you guys are
more expert than I am.

Thanks in advance,

Xiaowei
 
Xiaowei,

The factor that determines whether you can update data from a form is not
whether the form's recordsource is a table or a query; it is whether the
recordset that is the recordsource is updatable or not.
Generally, recordsets comprising several joined tables (which I suspect is
the case with your query) are not updatable. To verify, try to update a
record directly in the query (rather than the form); you'll get a message in
the statusbar "Recordset is not updatable".
There are ways around this, depending on what you are trying to do:
If you have two tables with a one to many relationship and wish to update
both, you can use a form (for the one side of the relationship) with a
subform (for the many side of the relationship).
If you are only trying to update one table, and have added others in the
query merely so you can display some fields (e.g. a customer name and
address, based on Cust_ID), then the solution is different: you can either
(a) just use the main table to be updated in the query, and use DLookups to
get the other data, or (b) make the form's recordsource the table directly,
and use the DLookups in unbound text boxes on the form, along with a macro
or some code to requery as required.

HTH,
Nikos
 
Back
Top