Solved Add record in formB from formA (1 Viewer)

NearImpossible

Registered User.
Local time
Yesterday, 19:23
Joined
Jul 12, 2019
Messages
225
I have a main form with a tabctrl, and on tab 7 i have 2 forms that we will call formA and formB, both linked to the main form via facilityID

What I would like is to click a button in formA that will add a new record to formB.

When I try either of the following
Code:
Forms!formB.Form.Recordset.AddNew
or
Code:
Forms!FormB.SetFocus
DoCmd.GoToRecord , , acNewRec

I get the following "Run-time error '2450': Micorsoft Access cannot find the referenced form 'formB'

As these forms are on a tabctrl, i guess im not sure how to reference formB from formA.

please advise
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:23
Joined
May 7, 2009
Messages
19,231
it's always inside the Main form:

Forms!mainFormName!FormB.Form.Recordset.Addnew
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 20:23
Joined
Feb 19, 2002
Messages
43,223
It is almost always wrong to create "empty" records. It means that you are not bothering with any validation. So, empty fields, fields with incorrect data all get saved. Seriously poor practice.
 

Users who are viewing this thread

Top Bottom