Mel said:
I created a form populated by a query ("update form query") The reason for
the form is to update records when needed. I added a button ("SAVE
RECORD")
with an embeded macro whose action is "save" with an argument of "query,
update form query". When I change a value on the form and click "SAVE
RECORD" I get an error message (error number 2950) saying that the "update
form query" is not open. When I check, however, the query and table are
both
updated.
One problem is that I don't understand what you mean. "Populated by a
Query" could mean that the Query is the RecordSource for the Form; or it
could mean that you have an unbound form, that you run Query, and that you
move the data to the Form. In the latter case, you'd have to pick up the
data from the (unbound) Controls on the Form and execute an Update Query to
update the table.
Queries are not "updated" -- they retrieve data from tables (either directly
or via other tables), update data, delete data, or append data, but they are
not themselves "updated".
The normal, and simple, way to update data is with a bound Form... that is,
a Form with a Record Source of either a Table or a Query, and with Controls
having a Control Source of Fields in the RecordSource. Changes to the
Controls on the Form are automatically saved when you close the Form, when
you move to a different Record, or when you move back and forth to/from
Subform Controls. The "Save" operation is just there to ensure an update in
case none of those have occurred -- and it is available in macros and in the
DoCmd statement in VBA code.
However, not understanding what you have and what, exactly, you have done, I
can't offer suggestions about your specific case.
I do all my work with VBA code, so I am not the one to discuss macros. For
years, I have thought that VBA was at least as simple and straightforward as
macros, but the product team or those who give them direction seem to think
there's really a reason. Their most recent "reason" for pushing macros is
"security".
Larry Linson
Microsoft Office Access MVP