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!

Need Subform to point to new Record

Status
Not open for further replies.

jryan3

Technical User
May 18, 2001
18
US
I have a form containing a subform. Two fields are used to link the form and subform. The subform displays with its record selector on the first matching record in the subform. I would like to have the record selector in the subform pointing to a new record so that the user can start entering their data for a new record without having to manually move to the new record. ( When the new data is entered, the linked fields still need to be automatically populated.)
I have modifed the on load event of the subform to bring up the subform on the new record. It works OK if I bring up the subform directly. However, when the subform is brought up within the form, it appears that the onload event is ignored and the subform's record selector is pointing to the first record and not the new record.
Any recommendations on how I can resolve my dilemma?
Thanks,
Joe
 
Do it in VBA!

Here's how:
On the Open event of the subform, add this code

private sub ... On_Open()
DoCmd.GoToRecord , , acNewRec
end sub

Hope I'm of any help.
 
I already tried the code:
private sub ... On_Open()
DoCmd.GoToRecord , , acNewRec
end sub

It works OK when the subform is displayed directly but not when it is displayed as a subform with fields linked to the parent form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top