473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Add record in second subform

Ok so I have a simple form, with two subforms. Main form is artists, subform1 is albums and subform 2 is tracks.

Anyway I'v managed to make a button on the main form for adding records to subform1 with the following code:

Me!subform1.SetFocus
DoCmd.GoToRecord , , acNewRec

I'v tried to do the same thing with a different button to add records to subform2 but I'm having no luck. Why is this?

Me!subform2.SetFocus
DoCmd.GoToRecord , , acNewRec

I'm guessing it's something to do with subform2 (tracks) being based on subform1 (albums)??
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Also in subform1 I am unable to enter data but I am able to this in subform2. I am also able to edit current records in subform1. I have checked the following for subform1:

Enabled is Yes
Locked is No
Allow Edits is Yes
Data Entry is No

The subforms are based on tables

Thanks in advance
Apr 8 '08 #1
1 1827
check out eh naming conventions

If you are on
Main form Sub 1
To refer to a form property, like RecordSource
On Mainform Me.RecordSource Me.Parent.RecordSource
On Sub 1 Me!Subform1.Form.RecordSource Me.RecordSource
On Sub 2 Me!Subform1.Form!Subform2.Form.
RecordSource Me!Subform2.Form.RecordSource
To refer to a control
On Mainform Me!ControlName Me.Parent!ControlName
On Sub 1 Me!Subform1.Form!ControlName Me!ControlName
On Sub 2 Me!Subform1.Form!Subform2.Form!
ControlName Me!Subform2.Form!ControlName
To refer to a control property, like Enabled
On Mainform Me!ControlName.Enabled Me.Parent!ControlName.Enabled
On Sub 1 Me!Subform1.Form!ControlName.Enabled Me!ControlName.Enabled
On Sub 2 Me!Subform1.Form!Subform2.Form!
ControlName.Enabled Me!Subform2.Form!ControlName.Enabled
To refer to a subform control property, like SourceObject
On Mainform N/A N/A
On Sub 1 Me!Subform1.SourceObject N/A
On Sub 2 Me!Subform1.Form!Subform2.SourceObject Me!Subform2.SourceObject

If you are on
Sub2 Not in these forms
To refer to a form property, like RecordSource
On Mainform Me.Parent.Parent.RecordSource Forms!Mainform.RecordSource
On Sub 1 Me.Parent.RecordSource Forms!Mainform!Subform1.Form.RecordSource
On Sub 2 Me.RecordSource Forms!Mainform!Subform1.Form!Subform2.
Form.RecordSource
To refer to a control
On Mainform Me.Parent.Parent!ControlName Forms!Mainform!ControlName
On Sub 1 Me.Parent!ControlName Forms!Mainform!Subform1.Form!ControlName
On Sub 2 Me!ControlName Forms!Mainform!Subform1.Form!Subform2.
Form!ControlName
To refer to a control property, like Enabled
On Mainform Me.Parent.Parent!ControlName.Enabled Forms!Mainform!ControlName.Enabled
On Sub 1 Me.Parent!ControlName.Enabled Forms!Mainform!Subform1.Form!ControlName.Enabled
On Sub 2 Me!ControlName.Enabled Forms!Mainform!Subform1.Form!Subform2.
Form!ControlName.Enabled
To refer to a subform control property, like SourceObject
On Mainform N/A N/A
On Sub 1 N/A Forms!Mainform!Subform1.SourceObject
On Sub 2 N/A Forms!Mainform!Subform1.Form!Subform2.
SourceObject
Apr 13 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sixsoccer | last post by:
I have built a database with a <Mainform> and a <Subform>. My problem is twofold. 1. My subform is set as a continuos form with AllowAddiotions set to NO (ie. a list of Issues to the client on...
0
by: RAllsopp | last post by:
I am having trouble deleting a record from a subform. I actually have a main form with two subforms, one dependent on the record selected in the other. The user selects a record to view on the...
6
by: Paul T. RONG | last post by:
Dear all, The OrderDetail subform has following fields: OrderDetailID OrderID ProdID Quantity Price how to get the OrderDetailID of a record I sellected in Orderdetail subform using...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
2
by: whitc26 | last post by:
Let me preface: I'm a novice, and have no programming experience. I have created an access database and have a few tables in it. I have created a form called "clients" This form opens up and...
3
by: Robert | last post by:
I have a form with two subforms on it. both subs have the same controlsource. Subform1 is a continuous form that acts as an index. The second subform is a single record that the user will use to...
4
by: Ecohouse | last post by:
have a main form with two tabs, and each tab has a subform. The first tab's subform refers to the mainform (this works). The second tab's subform refers to the identity key of the first tab's...
4
by: QntmPg | last post by:
Hi all, I have read through what I could find on previous questions regarding using the OpenArgs property, but I'm still not able to get my form to open correctly. I'm not sure exactly where the...
0
by: TD | last post by:
I have a main form with two subforms (both in datasheet view), neither of which are linked to the main form. The main form is based on a query that uses the bound column of a combobox on the main...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.