I have three option buttons (1 option group): construction projects, non construction projects and aquisition projects.
I have created a form with more than 35 data entry fields for each of this options.ex.frmConstructionProjects,frmNonconstruct ionProj, frmAquisitionProjects
When user selects an option fromm the options group it should open the respective subform. -
Private Sub optProject_Click()
-
If Me.optProject.Value = 1 Then
-
DoCmd.OpenForm "frmNonConstructionProj
-
Else
-
If Me.optProject.Value = 2 Then
-
DoCmd.OpenForm "frmConstructionProjects
-
Else
-
If Me.optProject.Value = 3 Then
-
DoCmd.OpenForm "frmAquisitionProjects"
-
End If
-
End If
-
End If
-
End Sub
-
It opens a new form rather than putting it like a subform under the option group object. How to make it look like a subform which only contains a data respective to the selected option?
Thanks !!
21 6530
It sounds like you want to use a Tab control, and put the appropriate data on each tab page.
Thats one way!!
here is some change in req.
I want all those option buttons on main tab. When user selects one of the option the respective subform (or form)should be opened on 11th tab.
The goal here is :Not giving user the access to all the three kinds of prjects type's data entry fields!!
thanks much!!
You could have 3 subforms and show/hide them. Or, if the format of the subform is the same, you could just dynamically set the source for a single subform.
Actually, it doesn't seem like you need a subform, just a bunch of controls (data entry fields) that you can hide/unhide.
Where to write the code for show/hide the subform and how?
Is it under the click event of the 11th tab (page)?
something like -
If Me.optProject = 1 Then
-
Show "frmConstructionProjects"
-
End If
-
I'd probably keep it in the option group's After_Update. Then you won't change it needlessly. You can do:
You probably want to set one form to Visible = True, and the other two forms to Visible = False in the AfterUpdate code that you already have. Are there 3 values for your optProjects, because you need a case for each of them.
None of the subforms are going to be visible if the user isn't viewing the tab that they are on anyway, but if you really want to hide them you can watch for the tab control's Change() event, test the value of the tab control to see what # tab is now being viewed, and hide/show things accordingly.
Thanks ChipR for your help!! I appreciate it.
Here is the code if anybody is looking at this thread for help themselves!! -
Private Sub optProjects_AfterUpdate()
-
If Me.optProjects.Value = 1 Then
-
frmConstructionProjects.Visible = True
-
frmNonConstructionProj.Visible = False
-
frmAquisitionProjects.Visible = False
-
End If
-
-
If Me.optProjects.Value = 2 Then
-
frmNonConstructionProj.Visible = True
-
frmConstructionProjects.Visible = False
-
frmAquisitionProjects.Visible = False
-
End If
-
-
If Me.optProjects.Value = 3 Then
-
frmAquisitionProjects.Visible = True
-
frmConstructionProjects.Visible = False
-
frmNonConstructionProj.Visible = False
-
End If
-
-
End Sub
OR -
Private Sub optProjects_AfterUpdate()
-
Select Case Me.optProjects
-
-
Case 1
-
-
frmConstructionProjects.Visible = True
-
frmNonConstructionProj.Visible = False
-
frmAquisitionProjects.Visible = False
-
-
-
Case 2
-
-
frmNonConstructionProj.Visible = True
-
frmConstructionProjects.Visible = False
-
frmAquisitionProjects.Visible = False
-
-
Case 3
-
-
-
frmAquisitionProjects.Visible = True
-
frmConstructionProjects.Visible = False
-
frmNonConstructionProj.Visible = False
-
-
Case Else
-
frmAquisitionProjects.Visible = False
-
frmConstructionProjects.Visible = False
-
frmNonConstructionProj.Visible = False
-
End Select
-
-
End Sub
-
I know it is easy but still!!!
I am sorry but I am too impatient..I have one more question regarding the same issue.
When we are going through records using record navigation, it does not change the respective form on 11th tab although it does show (and change it while we are going through records) the option selected previously..
why is that and how to fix it?
It sounds like you have one option button and subform for each type of project, so they will both need to be updated in the Form's Current() event.
What I mean is, in the Current event, check the project type, then set the optProjects value. Doing this in code probably will not trigger the option group's after update event, but you can call it yourself.
No I have a optionGroup not a single option button. This group has three options and user selects one of them and be able to see the respective form on the 11th tab.
It works very well when we are entering new record. But does not update the form according to the option selected for the previous data.
Sorry I didn't get the part that says to do something with form's current event.
Can u give a little more hint on that, please?
I'm not clear on what is supposed to happen when a user moves to another record. Does the subform shown depend on the the option selected only, or on some attribute of the record?
Ya it only depends on the option selected.
The showing of a subform on the 11th tab does not rely on any other attributes but the option button..
@jinalpatel
I'm very confused by this. What does not change, what does, what should?
Ok
When the user navigates through records, the records are changed on each and every tab. (normal behaviour)
Here, on the first tab it changes the option automatically but does not change the respective form based on that option on 11th tab.
I think this is the issue of refreshing the data each time user navigates through the records. I need to somehow find the way so that the access refreshes itself and show the respective record on each and every tab.
For example,
On main tab I have three options animals, birds and reptiles. On 11th tab I have data entry filds for their qualities
If I am navigating through the records, and my first record has option selected as Animal, it should show the qualities for animals on 11 th tab.(this should make sense)
But here it shows option selected as animals and qualities (on 11th tab) of birds
(because last time when I left access I entered record which has option selected as birds)
Does this make sense?
If not then it is ok..I need to figure it out somehow!!!!
Thanks!!
Just a few more questions, I promise :-] @jinalpatel
How is this changed automatically? I was under the impression from your other post that the option group and hence the subform were only selected by the user.
Do you have a default set for the option group when the form first opens? Try putting this in the Form's Current event:
I think my hard work to explain you worked and it is working with just a single line of code.Perfect!!! Many many thanks to you for helping out..
I just wrote -
Private Sub Form_Current()
-
optProjects_AfterUpdate
-
End Sub
-
I'm glad you got it working :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: CSDunn |
last post by:
Hello,
In Access ADP's that connect to SQL Server databases, any time I have
a situation where I have a combo box in a main form that looks up a
record in a subform, the subform record source has...
|
by: Alienz |
last post by:
Alien hello to whoever is reading today. Ill try to explain this as
simply as possible its just a weird thing thats happening here in
Access 2000 subforms..
I think something small is out of...
|
by: Lyn |
last post by:
Hi,
I am working on a genealogy form. The only table (so far) lists everybody
in the family, one record per person. Each record has an autonum ID.
The parent form (frmMainForm) displays the...
|
by: Lyn |
last post by:
Hi,
I am working on a genealogy project in which I have two tables:
Person -- one record for each person in the family. Each record has a
unique Autonum field (IDPerson).
Partnerships -- one...
|
by: NBruch |
last post by:
Ok let me explain what im trying to do:
i need a combo box which needs to be linked to a listbox (or combo box
doesnt matter which really) then the listbox should bring up the record
in a...
|
by: PC Datasheet |
last post by:
I'm stuck on something that seems should be easy and I need some help. My
main form has an option group with five options. My subform chooses from
different lists depending on which option is...
|
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: natwong |
last post by:
Hi All,
I'm a newbie in terms of Access and some of its functionality . I've been stuck on this problem for a couple days, even after searching the Web, etc.
Currently I have five combo boxes...
|
by: Coll |
last post by:
I have a form with a subform on it. On my main form, you select an
employee id number and the top portion of form fills in with data, and
the bottom portion of the form,which is a subform, lists...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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...
|
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |