Append query works in DB view not in macro


Joseph Rosing

I have form which the user enters data into. Upon clicking a "Finish"
button, a query is run which takes the information from the form,
queries it against a linked table, and appends the results to an
internal table. The button also then takes the user to the next record
in the form. The macro steps are:
SetValue (sets a time stamp value on the form)
SetWarnings (No)
OpenQuery (runs the append query)
GoToRecord (New).

I have primary keys set up in the internal table which data is appended
to in order ensure only "new" data is appended.

The problem I'm having is that when the button is clicked, the form's
background table successfully logs the information from the form and
the form goes to the next record; however, the append query does not
run. If I then run the query from the database view, the query works
and appends the records to the internal table. Why does this work from
the database view and not from the macro?

The parameters of the OpenQuery macro are:
QueryName: SetupData
View: Datasheet
Data Mode: Edit

Thanks for your help.


Steve Schapel


It could be that the data being entered needs to be written to the table
that the form is bound to, before it can be used as the basis for the
Append Query. Try putting an action like this into your macro, before
the OpenQuery...
RunCommand / SaveRecord

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question