Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform somehow out of sync on new record in main form

Status
Not open for further replies.

Jedi420

Programmer
Jun 21, 2002
184
US
Hello,

I have a main form that displays project information and a subform that show all the status updates for that project. I link the master and child fields together using the project ID. However, as I'm adding a new record, right when I first enter anything into any of the main form's fields (which will in turn assign it an autonumber), the subform displays the status for the last record that I've viewed.
If I click on the subform, however, the statuses will disappear and so I can enter in statuses on project creation time, but its very frustrating to add a new project, and to see status that you know shouldnt be there. Any help or suggestions on how to get rid of this would be greatly appreciated. (^_^)
 
Is it possible to requery the subform on the current event of your new form. You should just be able to call

<Subform>.Form.requery
 
Well, that's possible, but doesn't really solve the problem. The main form's form_current() event doesn't go off when someone selects a field or enters text. See, what happens is:

1. Someone clicks 'Add New Project'
which takes them to the newRecord of that form

2. Before they type anything, everything is fine. The
record that is being added hasnt recieve its new auto
number yet or anything.

3. As soon as someone types anything in any field on the
main form, that's when the bogus statuses in the
subform appear.

4. When you click on the subform, the bogus statuses
disappear.

Thank you very much for replying though, but I would really appreciate any assistance you or anyone else could give.

-Jedi420
 
Actually, this shouldn't happen like that.
what command are you using to move to the new record?
try using this:

DoCmd.GoToRecord , , acNewRec

also are you in form view
 
Hi,

Thanks for responding ... That is the exact command I am using to move to the new record. Everything looks fine until you actually type some text in a field. I've found that refreshing the form clears away the bogus statuses, but that produces another error whenever I try to leave a field after entering text in it that says 'Update or cancelUpdate without addNew or Edit'. I'm not even opening any recordsets at the time. If you have any ideas, I'd be most grateful.

-Jedi420
 
Would it matter if my subform is in the Footer section of my Main form????

-Jedi420
 
Got it! ... It was the fact that my subform was in my footer (for aesthetics). I guess that makes sense since the footer and header arent really reserved for record related items, but should be used for stuff like labels and buttons and what not. Thanks for the help guys .. appreciate it (^_^)

-Jedi420
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top