Open Form to New Record (1 Viewer)

njdaisy86

New member
Local time
Yesterday, 19:19
Joined
Oct 3, 2017
Messages
5
I have a two table relational (1 to many) database. Parent Table (tbl_Employee) and child table (tbl_transfer) are joined by EmployeeID. I created a form/subform where the Record Source is a parameter query. The parent/child table displays the current records appropriately which I've set to (parent - snapshot) and (child - "Allow Additions/Deletions/Edits: No").

When the query returns the results, I want the form to open and display (read-only) all the records from the parent and child table but place the cursor on the new record in the sub-form.

I've tried the following command: Me.[frm_TransferSubform].SetFocus
Docmd.GoToRecord , , acNewRec
on the main form On Current, On Load. I put the Docmd.GoToRecord , , acNewRec in the sub-form On Current, On Load.

All attempts result with the parent table displaying the correct record but the subform records are not displaying....only the new record field will display. The sub-form is a Continuous Form. Help! (P.S. - I know very little about SQL)
 

njdaisy86

New member
Local time
Yesterday, 19:19
Joined
Oct 3, 2017
Messages
5
Sorry, the heading should be "Open Form to New Record in Sub-form"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:19
Joined
May 7, 2009
Messages
19,231
you set Only AllowEdits and AllowDeletion to No
on the SubForm. Leave AllowAddition Yes.
Otherwise users, will not be able to enter
new records to the Subform.

on the current event of the Main form:

Code:
Private Sub Form_Current()
	On Error Resume Next
	[frm_TransferSubform].Form.Recordset.AddNew
End Sub
 

Users who are viewing this thread

Top Bottom