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

Need help to open / populate subform first

Status
Not open for further replies.

NeilT123

Technical User
Jan 6, 2005
302
GB
I have been trying to improve the way one of my more complicated forms loads. Originally there was a lot of conditional formatting which made the form "flicker" when loaded and when changed.

I have helped the issue by having an unbound textbox called txtCurrent on one of the sub-subforms and then using that textbox as part of the expression in the conditional formatting.

The textbox is populated by the following code

Code:
Private Sub Form_Current()
Me.txtCurrent = Me.[CroppingNumber]
End Sub

The problem occurs when the form is opened for the 1st time and I get a message box asking for the value

Forms!frmIFTFertAppln!frmIfFertAppln.Form.frmIfSfFertAppln.Form.CroppingNumber

I am assuming that the reason for this is that the subform is trying to load before the main form but I don't know how to deal with this.

If I open the form in form view and compile the code then the form works fine until I close and reopen the database.

Are there any suggestions as to how I should deal with this please?

Thank you as always for any suggestions.
 
Records in subforms are typically related to records in parent forms. I would expect you could use DLookup() to grab the appropriate value from the appropriate record.

Duane
Hook'D on Access
MS Access MVP
 
Just for clarity it is the unbound textbox txtCurrent that appears to be causing the issue. If I delete that textbox then the message box doesn't pop up so I need to know how to populate txtCurrent before the form opens.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top