473,785 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Navigating from Main form to subform to sub-subform

Please help! I have 3 forms: Task, Subtask, Elements.
Elements is a subform of Subtask and Subtask is a subform of Task. I
am able to navigate from Task to Subform to Element and from Element to
Subtask to Task by pressing a button that makes each subform
invisible/visible.
The problem exists when I try to navigate from Element to Task to
Subtask. Sub-subform Element will become invisible and show Task but
when I press the button to go from Task to Subtask it opens the subform
but Element is still visible over the Subtask form. Below is the code
I am using....
From Main form, Task to subform, Subtask: Private Sub ViewSubtasks_Cl ick()
On Error GoTo Err_ViewSubtask s_Click
Me.SubTasks.Vis ible = True
Me.Title.SetFoc us
Exit_ViewSubtas ks_Click:
Exit Sub

Err_ViewSubtask s_Click:
MsgBox Err.Description
Resume Exit_ViewSubtas ks_Click
End Sub

Subform Subtask's Title event when title has focus:
Private Sub Title_GotFocus( )
Forms!tasks!Sub Tasks!Elements. Visible = False
End Sub
From sub-subform, Element to Main form, Task:

Private Sub ViewTasks_Click ()
On Error GoTo Err_ViewTasks_C lick
Forms!tasks!Tit le.SetFocus
Forms!tasks!Sub Tasks.Visible = False

Exit_ViewTasks_ Click:
Exit Sub

Err_ViewTasks_C lick:
MsgBox Err.Description
Resume Exit_ViewTasks_ Click
End Sub

Apr 21 '06 #1
1 3397
Hi.

Hundreds of people have read your question and might have answered it, but
they skipped it because it's very unclear. You've left out information, you
have typos, and even when the typos are fixed, the code you offered doesn't
do what your description says it does.

Therefore, I'm going to make a bunch of assumptions and offer you some code
that I think does what you intend yours to do. First, make a copy of your
main form, Task, and name this new form frmTask. Open up this new form's
module, delete the code you have (at least the part that you posted here
yesterday) and replace it by pasting the following code into it:

' * * * * Start Code * * * *

Private Sub ViewSubtasks_Cl ick()

On Error GoTo Err_ViewSubtask s_Click

Me.Subtasks.Vis ible = True
Me.Title.SetFoc us
Me!Subtasks.For m.Controls("Ele ments").Visible = False

Exit_ViewSubtas ks_Click:
Exit Sub

Err_ViewSubtask s_Click:
MsgBox Err.Description
Resume Exit_ViewSubtas ks_Click
End Sub
Private Sub ViewTasks_Click ()

On Error GoTo Err_ViewTasks_C lick

Me!Title.SetFoc us
Me!Subtasks.Vis ible = False

Exit_ViewTasks_ Click:
Exit Sub

Err_ViewTasks_C lick:
MsgBox Err.Description
Resume Exit_ViewTasks_ Click
End Sub
Private Sub ViewElements_Cl ick()

On Error GoTo ErrHandler

Me!Subtasks.For m.Controls("Ele ments").Visible = True
Me!Title.SetFoc us

Exit Sub

ErrHandler:

MsgBox "Error in ViewElements_Cl ick( ) in " & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & Err.Description
Err.Clear

End Sub

' * * * * End Code * * * *

Make sure that I've spelled your subform controls and three button names
correctly, then save and compile the code. Open this new form in Form View
and test it. Does it work the way you intended? If not, please post back
with a discription of what you'd like it to do and what's happening instead.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"dBNovice" <lu*****@hotmai l.com> wrote in message
news:11******** **************@ z34g2000cwc.goo glegroups.com.. .
Please help! I have 3 forms: Task, Subtask, Elements.
Elements is a subform of Subtask and Subtask is a subform of Task. I
am able to navigate from Task to Subform to Element and from Element to
Subtask to Task by pressing a button that makes each subform
invisible/visible.
The problem exists when I try to navigate from Element to Task to
Subtask. Sub-subform Element will become invisible and show Task but
when I press the button to go from Task to Subtask it opens the subform
but Element is still visible over the Subtask form. Below is the code
I am using....
From Main form, Task to subform, Subtask:

Private Sub ViewSubtasks_Cl ick()
On Error GoTo Err_ViewSubtask s_Click
Me.SubTasks.Vis ible = True
Me.Title.SetFoc us
Exit_ViewSubtas ks_Click:
Exit Sub

Err_ViewSubtask s_Click:
MsgBox Err.Description
Resume Exit_ViewSubtas ks_Click
End Sub

Subform Subtask's Title event when title has focus:
Private Sub Title_GotFocus( )
Forms!tasks!Sub Tasks!Elements. Visible = False
End Sub
From sub-subform, Element to Main form, Task:

Private Sub ViewTasks_Click ()
On Error GoTo Err_ViewTasks_C lick
Forms!tasks!Tit le.SetFocus
Forms!tasks!Sub Tasks.Visible = False

Exit_ViewTasks_ Click:
Exit Sub

Err_ViewTasks_C lick:
MsgBox Err.Description
Resume Exit_ViewTasks_ Click
End Sub

Apr 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
3345
by: andre | last post by:
HI, I’m learning C# and already know VB .Net. I noticed that C# you have a Static Void Main () (entry point of the app). Well that got me thinking, I was told that VB.net removed “The Black Box” of software (hidden code). Where is my Shared sub Main ()? When I create a blank app and run it, it asked me where is Shared sub Main. So, can I assume that it’s hidden on a win32 app? And if so, why hide it?
17
4229
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset Set rs = Me.RecordsetClone rs.Find "=" & lngContractID If Not rs.EOF Then Me.Bookmark = rs.Bookmark I must site the Heisenberb Uncertainty Principal here, as it
1
1811
by: Richard Hollenbeck | last post by:
I have a main form for entering students' grades. The main form indicates which activity I will be entering. The sub form on the right contains the actual score for the activity. It is based on a table with a composite key (ActivityID and StudentID) and needs to get those two key values populated with data from the main form and the other sub form on the left. The ActivityID should automatically fill the new records with the...
1
1263
by: Lerp | last post by:
Hi all, I have a dataset made up of 3 tables that is bound to a datalist. On the itemdataBound event I call a sub that grabs a value (an id value) from the current row being outputted, queries the database using this id value to return a string value that I replace the id with in the datalist. My question is this: instead of re-querying the database can I use the dataset to replace this value using the id?
5
7428
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is navigating through the data. I can get the data into a datagrid without any problems, but I want the data to show up in textboxes and use some sort of move next, move previous, move last, etc (like in VB6) command to navigate the data (using...
4
3584
by: Charles Law | last post by:
Hi guys. I have two threads: a main thread and a background thread. Lots of stuff happens in the background thread that means I have to update several (lots) of controls on a form. It is quite tiresome to have to write code to call MyControl.Invoke for each control on the form, along with the delegates that are required for each. Is there a better way to do this? What I mean is, if I could marshal the
1
1456
by: VictorT | last post by:
Hi All, I am trying to create a simple Windows form that lists a users' data one user at a time with the usual "Next" & "Previous" buttons. Upon loading the form, I am able to populate all textboxes however when clicking either of the buttons, nothing happens - the data from the next/previous rows does not re-populate the textboxes. This is an extremely simple situation yet I cannot figure out what is going wrong. Can anyone help? I've...
8
6462
by: koorb | last post by:
I am starting a program from a module with the Sub main procedure and I want it to display two forms for the program's interface, but when I run the program both forms just open and then program closes. Dim FORM1 As New Form1 Dim FORM2 As New form2 Sub main() FORM1.Show() FORM2.Show()
0
1431
by: Ohad Weiss | last post by:
Hi all, I've once asked about that topic. but didn't get an answer. I have a dataset based on 4 tables, which have relation between them. The main table presented to the user on textboxes placed on the form, and the rest of the tables presented on textboxes placed on tabpages (tabpage for each table). Here is the code I use:
5
2456
by: Thelma Roslyn Lubkin | last post by:
I am still having trouble trying to use a popup form to allow user to set filters for the main form. The main form is based on a single table. The popup contains 5 listboxes, so the user can filter on 5 fields in this table, and can include as many field values as s/he needs. The popup is reached from a command button on the main form : This button is on the main form, Datasystem:
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9481
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8979
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.