Include Current Record In Subform

M

Melissa

I have a single (not continuous) form with an Undo button for entering
finished projects. On the form is also a subform that lists all finished
projects for reference. When I enter the CompletionDate which is near the
beginning of all the fields, I would like the current project to appear in
the subform which lists all the finished projects. I can't save the current
project at that point because I wouldn't be able to use the Undo button
after that. How can I display the unsaved current project in the list of
finished projects after I enter the completion date? I am open to using a
listbox instead of a subform if that would make it possible.

Thanks!

Melissa
 
T

tina

well, presumably the subform's RecordSource is a query or SQL statement that
uses some criteria (perhaps something like "CompletionDate Is Not Null") to
display only completed records. until you save the CompletionDate entered in
the current project record, the data is not in the table, and so it can't be
pulled by the subform's RecordSource.

the closest thing i can think of is to change the RecordSource, perhaps in
the CompletionDate control's AfterUpdate event, setting criteria to
something like

CompletionDate Is Not Null Or PrimaryKeyField =
Forms!MainFormName!PrimaryKeyField

and then requerying the subform. that would give you all completed (and
saved) records, plus the current mainform record.
you'd have to contend with resetting the RecordSource back to the original
each time you move to another record, and also in the event of an Undo
command.

hth
 
S

Steve Schapel

Melissa

I would use some code (e.g. DoCmd.RunCommand acCmdSaveRecord) on the
AfterUpdate event of the CompletionDate control to write the new record
to the table and then Requery the subform. I know you feel you won't be
able to use an 'Undo' button, as you said, but unless there is some
other reason which we don't know about, I can't see why not... just put
code on your Undo button to delete the record.
 

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

Top