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.frmC onstructionProj ects,frmNoncons tructionProj, frmAquisitionPr ojects
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 6559 ChipR 1,287
Recognized Expert Top Contributor
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!!
ChipR 1,287
Recognized Expert Top Contributor
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
-
ChipR 1,287
Recognized Expert Top Contributor
I'd probably keep it in the option group's After_Update. Then you won't change it needlessly. You can do: ChipR 1,287
Recognized Expert Top Contributor
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!!!
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 to be based on
either a View or a Table. I can almost always use a View, and it helps
to do this since I can have better control over the size of the
RecordSet of the subform.
There are times when the use of a Stored Procedure would give me...
|
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 place. If you have a sec to share
some human thoughts it would be much appreciated!!! I created a
subform that is linked to a main form. I locked all of the combo
boxes in the subform and basically my goal is to have the subform
display whatever...
|
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 data in each record, which
includes the ID of the father and the mother (who also have records in the
table). One record per form.
I have a Tab Control in the form, and in one of the tabs I have a subform
(sfmSiblings) in which I wish to list...
|
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 record for each marriage. Each record has a unique
Autonum field (ID), and also contains two fields IDPartnerMale and
IDPartnerFemale. Both of the latter fields match records in the Person
table via IDPerson.
|
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 subform.
so you pick a name (in the combo box in the main form) then it should
bring up all the dates for which the person has a record for (in the
list box or combo box) and then once you pick a date it should bring up
the specific record you want...
| |
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 selected in the main form. I
thought all I had to do for the subform was create a query and set the
criteria equal to the option group value in the main form. No way, Jose!
When the form/subform opens, the option group value is not available to the...
|
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:
Me!subForm.Form!txtTextBox
and for some reason, in certain contexts, we get the error:
Error 2455: You entered an expression that has an invalid reference
|
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 (actually list boxes) that are multiselects in my main form. I need to use these combo boxes to filter a subform within my main form.
My combo boxes are as follows:
1. A - 4 select options
2. B - 10 select options
3. C - 4 select options
|
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 existing
records there are for that employee (one to many relationship). How
can I set up my main form, so the user can select one of the records
on the subform and retain that recordid number for use in opening a
new form and displaying the that...
|
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...
|
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,...
| |
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |