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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform opens already populated...Don't want this

Status
Not open for further replies.

btj

Technical User
Nov 17, 2001
94
US
I have a main form and subform joined by a field called Category. When I open the form, the Category field (which is an unbound text box) is empty, but the subform (in datasheet view) is populated with records from the previous use.

I want to be able to open the form and not have the subform be pre-populated. I think the solution lies with the use of requery but am unsure how to implement it.

Does anyone have any suggestions? I would greatly appreciate any ideas that you may have.

Thanks,
Ben
 
Try putting a Me!sfrmWhatever.requery in the Form Current timing point of the parent form and see if that solves the problem...
 
Thanks for the tip...I tried putting the following under my Main form's OnCurrent event:

Me!ST_003_Subform.Requery and Me.ST_003_Subform.Requery...but neither worked.

In addition, I noticed something else which may be indicitive of the issue. Whenever I choose a category in the main form that has no record related to the subform, the default value (that is there when I open the form) remains.

Does that give anyone a hint on what the underlying issue could be?

- Ben
 
Sutto,
Thanks for the tip...unless I am inputting the code wrong your solution does not work for me.

Please let me know if you have another thought...

- Ben
 
Do you have a record in the data populating the subform with an ID of 0 or null? If this was the case, it may show up for all cases where the main form has no related record in the subform and on opening.
 
No...but thanks to all that have submitted ideas. Please keep them coming.

Here is more information, if it helps:

The subform and main form are connected by a Category field. When the unbound Category field is populated, an AfterUpdate code runs and generates the records that have a corresponding Category in the subform.

When I open the form, the default records in the subform are from the first listed Category within the table. Once the Category field in the Main form is changed, the subform is updated, but I cannot seem to remove the subform from pre-populating.

Does that give anyone any other ideas?

- Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top