473,406 Members | 2,894 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.

reference a sub - subform control

30
I have a Main Form (Itineraries) which has a Command Button (Command11) . On the main fom I also have a sub form (ItineraryDetails). Now for every Itinerary details record there is sub sub form (ItineraryAccomodation) that I want to refer to. Would you be able to help me out I have attached an image of how the form is structured.

Below is the sample code I have tried to create.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command11_Click()
  2. On Error GoTo Err_Command11_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "ItineraryAccomodation"
  8.  
  9.     stLinkCriteria = "Me.ItineraryDetails.Form.[ItineraryDetailID]=" & Itineraries.ItineraryDetails.ItineraryAccomodation.Form.[ItineraryDetailID]
  10.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  11.  
  12. Exit_Command11_Click:
  13.     Exit Sub
  14.  
  15. Err_Command11_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_Command11_Click
  18.  
  19. End Sub
Attached Images
File Type: jpg datamodel2.jpg (11.3 KB, 410 views)
Jun 2 '09 #1
9 3840
ADezii
8,834 Expert 8TB
@xraive
I cannot make heads or tails of the Thumbnail Image, but I can show you the Syntax for referring to a Control on a Sub-Sub Form. Hopefully, this will point you in the right direction:
Expand|Select|Wrap|Line Numbers
  1. Forms![Main Form Name]![Sub-Form Name].Form![Sub-Sub Form Name].Form![Control Name]
Jun 2 '09 #2
xraive
30
Here is what i want to do. put a button on a main form that will open up a sub form of a record that is sub form to the main form.

I have Itinerary Form
ItineraryDetails
ItinerarayAccomodations

I would like to open the ItineraryAccomodations form which related to the itineraryDetails from from the Itinerary form
Jun 2 '09 #3
NeoPa
32,556 Expert Mod 16PB
This is how to refer to items on a subform - Referring to Items on a Sub-Form.

Frankly, your question and response seem to indicate that you want us to do it for you. This is not how things work here. You're welcome to ask technical questions about how to do things, but few if any of us take kindly to requests for simple solutions.
Jun 2 '09 #4
xraive
30
This is not what I intended but here is the code that I was working on.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command11_Click()
  2. On Error GoTo Err_Command11_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "ItineraryAccomodation"
  8.  
  9.     stLinkCriteria = "Me.ItineraryDetails.Form.[ItineraryDetailID]=" & Forms.[Itineraries].[ItineraryDetails].Form.[ItineraryAccomodation].Form.[ItineraryDetailID]
  10.  
  11.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  12.  
  13. Exit_Command11_Click:
  14.     Exit Sub
  15.  
  16. Err_Command11_Click:
  17.     MsgBox Err.Description
  18.     Resume Exit_Command11_Click
Jun 2 '09 #5
NeoPa
32,556 Expert Mod 16PB
Xraive, you say you have three levels of form, and you give the names of these which is useful.

Unfortunately you give different names in two of your posts so we don't really know what the names are.

The important thing that's missing though is that you don't say what you want help to achieve. This is why the answers you have so far received have been quite general.

To help you more we need accurate information of what you have, and a question that explains what you are trying to achieve.

I'm sure with these available one or more of us will be happy to help you further.
Jun 3 '09 #6
xraive
30
Now what I am trying to do NeoPa si:

I have a Main Form (Itineraries)
Sub Form (ItineraryDetails)
Sub Form (ItinerarayAccomodations)


I also have a button that is located on the Main Form.

now when a single record is selected on the sub form (ItineraryDetails) i want press the buttton on the Main Form (Itineraries) and it will open up the accomodations form (ItinerarayAccomodations) for that specific record. I tried to write an event procedure to do this and it is not working.
Jun 3 '09 #7
NeoPa
32,556 Expert Mod 16PB
Well, you still have a problem where the names of the items are not consistent across what you are posting. If you want help then you'd better get that sorted out first.

I made this point in my earlier post but you seem to have ignored it or not understood it correctly. Let me see if I can help you find that problem.

Look at the names you've posted and the code that you've tried and then say what the names actually are - as they do not match. I have no way of telling except from what you post - and that is still contradictory.
Jun 4 '09 #8
xraive
30
sorry about that..

these are the names of the forms

Main - Itineraries
Sub - ItineraryDetails
Sub - ItineraryAccomodation

I have a button on the main form that I would like to open the ItineraryAccomodation form for each record in ItineraryDetails that I select.

below is the code

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command11_Click()
  2. On Error GoTo Err_Command11_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "ItineraryAccomodation"
  8.  
  9.     stLinkCriteria = "Me.ItineraryDetails.Form.[ItineraryDetailID]=" & Forms.[Itineraries].[ItineraryDetails].Form.[ItineraryAccomodation].Form.[ItineraryDetailID]
  10.  
  11.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  12.  
  13. Exit_Command11_Click:
  14.     Exit Sub
  15.  
  16. Err_Command11_Click:
  17.     MsgBox Err.Description
  18.     Resume Exit_Command11_Click
  19.  
  20. End Sub
Jun 4 '09 #9
NeoPa
32,556 Expert Mod 16PB
Right, the details look fine now :)

Unfortunately, at 02:53 in the morning I cannot do much just now, but I will look again tomorrow as soon as I'm able.

What I notice that looks strange though (you may want to look at before I can do more) is that you are using DoCmd.OpenForm on ItineraryAccomodation. This is supposed to be a sub-sub-form (which wouldn't be opened like this). What is going on here? Is this a misunderstanding ?
Jun 4 '09 #10

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

Similar topics

3
by: DFS | last post by:
I've been working around this for years (I believe), so I figured someone here might know: Why won't a crosstab query accept a value from a form reference? TRANSFORM...
7
by: vindaloo1 | last post by:
I'm using Access 2000 and I have a main form and a subform. When a control on the subform is updated I am trying to update a control on the mainform. But instead of updating the control on the...
18
by: klawiter | last post by:
Greetings, I would like to change the background color of fields as they are entered for editing. (then, of course, change them back on exit) My prototype consists of using a couple of global...
14
by: simonmarkjones | last post by:
Hi, I'm having a bit of trouble editing an old database that was created quite a while ago by someone else. There is a form that lets the user select a member of staff and show details about the...
3
by: tlyczko | last post by:
I have a main form with 2 subforms, each subform references different data in the same table. How do I make sure each subform only creates NEW records in the referenced table and do not...
14
by: mchlle | last post by:
How can I filter records of a subform that is part of a tab control? The filter works fine on the form when it is not part of the tab using this in the macro condition: !!="Today" I have a main...
2
by: David W. Fenton | last post by:
I think at various times we've all encountered this problem: A subform is on a main form. From the code of the main form we refer to some property of/control on the child form thus: ...
14
by: (PeteCresswell) | last post by:
I've got a form (frmDeal) that has a subform (frmDeal_Tranche) that has a subform (frmDeal_TrancheCusip). When I try to refer to properties on the "Cusip" form at the end of the chain, MS Access...
6
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few...
5
by: ApexData | last post by:
My popup form can reference the MAINFORM by using either line of the code shown below: --------------------------------------------------------------------------------...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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...

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.