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

Subform data lost when filled in before containing form has data.

Status
Not open for further replies.

owrsome

Technical User
Jan 13, 2003
18
US
My Form (for the One table) contains a Subform (for the related Many table). If the Subform is filled in before any data goes into the containing Form, all Subform controls go blank when the user leaves the Subform to fill in the Form.

How can I either 1) permit filling in the Subform before the Form (preferred)without losing data or 2) remind/require the user to fill in one or two controls in the Form first?
 
Hi owrsome,

You could place this in the On Enter event of your sub form.

Note this is done while in the Main form's design view, not the Sub form's. Change Me!ID to your ID:
On Error Resume Next
If IsNull(Me!ID) Then
MsgBox "You must complete the Main form first!"
RunCommand acCmdUndo
Me!ID.SetFocus
End If

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top