By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,649 Members | 696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,649 IT Pros & Developers. It's quick & easy.

Include Current Record In Subform

P: n/a
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
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
"Melissa" <mb****@earthlink.net> wrote in message
news:gO****************@newsread3.news.atl.earthli nk.net...
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

Nov 13 '05 #2

P: n/a
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.

--
Steve Schapel, Microsoft Access MVP
Melissa wrote:
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

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.