?
Solved

Subform to open on new record

Posted on 2011-10-20
3
Medium Priority
?
299 Views
Last Modified: 2012-05-12
My mother form has a comments form which links to the tblComments.
The mother form also has a control that opens a daughter form which also has a similar comments form on it.
Presently when I make a comment while on the mother form and then navigate to the daughter form, the same comment that was active on the mother form is still active.
The same is the case if I make a comment on the daughter form and navigate to the mother form.
I want that each time the mother form opens, the comments form must open in a new record and vice versa.
I attach my database.
It opens on form "Process WIP Vessel Documentation". The comments form is at the bottom.
When you click on "General Information" control, the general Information form opens. The comments form is at the bottom. db2.mdb
0
Comment
Question by:Fritz Paul
  • 2
3 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36998996
Add the following code to the Open event of your main form:

     Me.frmtblComments.SetFocus
     DoCmd.GoToRecord , , acNewRec

Open in new window


(You would use similar code in both forms - just specifying the appropriate subform name for each)
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 36999011
So this would go in the open event of frmNewVesselGenInfo:
Private Sub Form_Open(Cancel As Integer)
'    ci_CenterIt Me, True, 3
    Me.frmtblComments.SetFocus
     DoCmd.GoToRecord , , acNewRec
End Sub

Open in new window


And this would go in the open event of frmProcWIPVessel:

Private Sub Form_Open(Cancel As Integer)
    Me.frmtblCommentsForfrmProcWIP.SetFocus
    DoCmd.GoToRecord , , acNewRec
End Sub

Open in new window

0
 

Author Closing Comment

by:Fritz Paul
ID: 36999311
Thanks a lot.
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question