473,406 Members | 2,467 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,406 software developers and data experts.

Recordset of Subform(Datasheet) inside another subform which is inside a mainform

2
Hi All,

I am new to this Forum.

Good Day All,

I'm having a problem with the syntax of a recordset of a Datasheet inside a subform which is also inside a Main Form.

Main Form - frm_1_0_LMS
Subform - frm_1_4_0_TeamApprovals
Subform(Datasheet) - frm_1_4_1_TeamApprovalsList

Here is my code:
Expand|Select|Wrap|Line Numbers
  1. Dim rs As DAO.Recordset
  2.  
  3. Set rs = Forms!frm_1_0_LMS.frm_1_4_0_TeamApprovals.frm_1_4_1_TeamApprovalsList.Form.Recordset
  4.  
  5. If Not (rs.EOF And rs.BOF) Then
  6.  Forms!frm_1_4_2_ApproveDeclineUserLeave.Controls("lblFiledDateLeave").Caption = rs!Leave_Date
  7. End If
  8.  
I am getting this error:
Object doesn't support this property or method

Any replies are highly appreciated.

Thanks in advance.
Dec 16 '13 #1

✓ answered by MikeTheBike

Hi

First we need to establish that the name of the sub-form CONTROL(S) have the same name as the forms thay contain (this is the default name when using a wizard).

On the basis that this is the case then to expose the sub-form's objects, properies and methods you need to refer tyo to FORM Object contained in the sub-form control. Therefore your code should be modified to look something like this

Expand|Select|Wrap|Line Numbers
  1. Dim rs As DAO.Recordset 
  2.  
  3. Set rs = Forms!frm_1_0_LMS.Form.frm_1_4_0_TeamApprovals.Form.frm_1_4_1_TeamApprovalsList.Form.Recordset 
  4.  
  5. If Not (rs.EOF And rs.BOF) Then 
  6.  Forms!frm_1_4_2_ApproveDeclineUserLeave.Form.Controls("lblFiledDateLeave").Caption = rs!Leave_Date 
  7. End If
HTH

p.s. not sure where frm_1_4_2_ApproveDeclineUserLeave is located !?

MTB

3 1853
MikeTheBike
639 Expert 512MB
Hi

First we need to establish that the name of the sub-form CONTROL(S) have the same name as the forms thay contain (this is the default name when using a wizard).

On the basis that this is the case then to expose the sub-form's objects, properies and methods you need to refer tyo to FORM Object contained in the sub-form control. Therefore your code should be modified to look something like this

Expand|Select|Wrap|Line Numbers
  1. Dim rs As DAO.Recordset 
  2.  
  3. Set rs = Forms!frm_1_0_LMS.Form.frm_1_4_0_TeamApprovals.Form.frm_1_4_1_TeamApprovalsList.Form.Recordset 
  4.  
  5. If Not (rs.EOF And rs.BOF) Then 
  6.  Forms!frm_1_4_2_ApproveDeclineUserLeave.Form.Controls("lblFiledDateLeave").Caption = rs!Leave_Date 
  7. End If
HTH

p.s. not sure where frm_1_4_2_ApproveDeclineUserLeave is located !?

MTB
Dec 16 '13 #2
ramoj
2
Thanks a lot MikeTheBike. Re: frm_1_4_2_ApproveDeclineUserLeave it is in a new opened form.

Really helps a lot.
Dec 16 '13 #3
zmbd
5,501 Expert Mod 4TB
MikeTheBike
is on the correct track as usual; however, just to provide both context and tools for your future work:

This is the most simple and sweet: Allen Browne: Referring to Controls on a Subform

THis is the reference I will use when I get lost:
Forms: Refer to Form and Subform properties and controls
I'm worried enough that this site might ever go down that I took advantage of the download offer of a hardcopy of the table - upper right hand corner!

General Search return: Google Search for VBA Form References

IF you are using the navigation control form available in ACC2010 the give a buzz, it's somewhat in a world of its own as a hybrid.
Dec 16 '13 #4

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

Similar topics

3
by: Charlene | last post by:
I have an Invoice/Invoice Details form/subform. In the page footer of the Invoice Details subform I have a textbox with the control source set to =Sum(). I then pull this value into the main form...
11
by: Ian Ornstein | last post by:
in posting http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&newwindow=1&selm=bmEK9.43452%24lj.1060600%40read1.cgocable.net Lyle showed us that an ADODB.Recordset can be created and attached to a...
3
by: Joshua Ammann | last post by:
Hi, (Using Access 2000) I have two tables, similar to Customers and Orders. (Not an exact parallel, but works for this example.) On a form showing customer data, there is a tab control. One...
1
by: tizmagik | last post by:
I have a Starting form ("frmStart") and a main form ("frmCustomer") inside frmCustomer are two subform, one with it's own subform. So frmCustomer has two subforms ("sbfArtist" and "sbfAddress")...
18
by: Robert Jacobs | last post by:
Please advise... I currently have a Mainform (Customers) and a Subform (Service Requests) with a one to many relationship (one customer, many service requests) with a CustomerID that is unique...
3
by: gblack301 | last post by:
Hi All, I have been racking my brain for sometime in trying to resolve this and now I am just wiped out. MS-Access 2003 I have a main form that contains several selection options (combo...
7
by: JohnHo | last post by:
I have been working with Access for a little while but have never used mainforms/subforms before. Here is my problem/scenario: I have a main form (frmMain) with a few other forms for data data...
3
Sigma7
by: Sigma7 | last post by:
This is my issue- I am a true novice to DBMS. I would like to accomplish the following feat: I have created a mainform and subform, and I would like to have the users to input information into the...
7
by: poornesh K V | last post by:
This is the details: I have a Form : ProjectDetails This form is made up of a TabControl : maintabctrl1 (Say 10 pages) Each page has a subform : subForm1 This subForm1 has tabcontrol :...
5
by: Sandra Walsh | last post by:
Hello All - I have a main form called f_MainTripForm_Admin with a split view. The main form has fields relating to a trip. The main form has 2 sub forms. The subforms have fields related to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.