using subform to navigate form

  • Thread starter Thread starter Christopher Glaeser
  • Start date Start date
C

Christopher Glaeser

frmMessage shows a) a message record and b) a continuous subform
frmMessagesSubform that shows all messages in a scrolled list.
frmMessagesSubform has a click event SelectMessage_Click(). What is the VBA
code that will set the frmMessage record to the record selected in
frmMessagesSubform?

Best,
Christopher
 
If the purpose of the subform is just to select the record to show in the
main form (i.e. navigation), use a list box instead. It's very simple,
requires no code.

1. Create an unbound form.

2. Place a list box at the left.

3. Beside it, add a subform where the full record is shown and can be
edited.

4. Name the list box in the LinkMasterFields of the subform control, with
the matching field in the LinkChildFields property.

Whenever you select a record in the list box, it is automatically shown in
the subform for editing.
 
Try unchecking the Action Queries box under:
Tools | Options | Edit/Find | Confirm

In code, you could:
DoCmd.SetWarnings False

A *much* better approach would be to use the Execute method to run your
action queries, e.g.:
dbEngine(0)(0).Execute "DELETE FROM Table1;", dbFailOnError

That line deletes the records without any confirmation, and yet still gives
you an error message if something goes wrong, e.g. if there is a locking
error, a related entry in another table that prevents records being deleted.
 
Back
Top