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. - Private Sub Command11_Click()
-
On Error GoTo Err_Command11_Click
-
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "ItineraryAccomodation"
-
-
stLinkCriteria = "Me.ItineraryDetails.Form.[ItineraryDetailID]=" & Itineraries.ItineraryDetails.ItineraryAccomodation.Form.[ItineraryDetailID]
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
-
-
Exit_Command11_Click:
-
Exit Sub
-
-
Err_Command11_Click:
-
MsgBox Err.Description
-
Resume Exit_Command11_Click
-
-
End Sub
9 3840 @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: - Forms![Main Form Name]![Sub-Form Name].Form![Sub-Sub Form Name].Form![Control Name]
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
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.
This is not what I intended but here is the code that I was working on. - Private Sub Command11_Click()
-
On Error GoTo Err_Command11_Click
-
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "ItineraryAccomodation"
-
-
stLinkCriteria = "Me.ItineraryDetails.Form.[ItineraryDetailID]=" & Forms.[Itineraries].[ItineraryDetails].Form.[ItineraryAccomodation].Form.[ItineraryDetailID]
-
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
-
-
Exit_Command11_Click:
-
Exit Sub
-
-
Err_Command11_Click:
-
MsgBox Err.Description
-
Resume Exit_Command11_Click
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.
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.
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.
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 - Private Sub Command11_Click()
-
On Error GoTo Err_Command11_Click
-
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "ItineraryAccomodation"
-
-
stLinkCriteria = "Me.ItineraryDetails.Form.[ItineraryDetailID]=" & Forms.[Itineraries].[ItineraryDetails].Form.[ItineraryAccomodation].Form.[ItineraryDetailID]
-
-
DoCmd.OpenForm stDocName, , , stLinkCriteria
-
-
Exit_Command11_Click:
-
Exit Sub
-
-
Err_Command11_Click:
-
MsgBox Err.Description
-
Resume Exit_Command11_Click
-
-
End Sub
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 ?
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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:
...
|
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...
|
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...
|
by: ApexData |
last post by:
My popup form can reference the MAINFORM by using either line of the
code shown below:
--------------------------------------------------------------------------------...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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: 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...
| |