[AccessD] When to Requery?

Gustav Brock Gustav at cactus.dk
Thu Dec 6 01:24:02 CST 2007


Hi Arthur

Given your SQL Sensei status, I guess you execute an SQL statement to append the new record?
If so, try to replace that with DAO where you open the RecordsetClone of the form's recordset and use AddNew/Update to append the record before the refresh.

/gustav

>>> fuller.artful at gmail.com 06-12-2007 02:59:52 >>>
I have a form with a subform (you've heard this one, I bet).

The subform is R/O and there's a button to add a new Item. This pops up a
dialog form that accepts the new data. The form has a button to Save, which
writes the record and then closes the form. I want to requery the subform to
reflect the newly added item at the top of the list.

The subform is sorted by TransactionID DESC, but my various attempts to
requery the subform suggest that I'm doing it in the wrong event. Here is
the scenario in more literal terms:

Main form: Riders_frm
Sub form: Transactions_fsub, containing a button that invokes "New
Transaction", which opens Transactions_New_frm.
User clicks Save on said dialog. Dialog closes, returning the user to the
Main form.

At this point, I wish the sub-form (Transactions_fsub) to refresh or requery
and display the newly-added record at the top of the grid, NOT at the bottom
(which it is currently doing). Yes, the user can re-sort the data but that's
not what I want. I want the Transactions to be sorted (either TransactonID
DESC or TransactionDate DESC -- both will work), but I can't seem to
automate it. Keystrokes are required and that's what I want to get around.

Any suggestions?

TIA,
Arthur





More information about the AccessD mailing list