473,573 Members | 2,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display only values related only to the value selected on previous field

Good morning, I have a table with three fields, Buildings, Floors and
Rooms.
This is what I would like to do; in my form when I select Building1 in
my drop down box for Buildings, when I go to the next drop down field
which is Floors, all I would like to see is just the floors that
belong to Building1 only and then once I have selected a value for
Floors, when I go to the next drop down field which is Rooms, all I
want to see are the rooms that belong only to the previous selected
Floor value, which belongs to that specific selected Building only.
Right now, when I go to my form and go to these fields what I get is
everything that there is in the table. I get to see all the Floors and
Rooms values for every building out there regardless of the value I
have selected for Buildings. How can I prevent this from happening?
How can I tight down the Rooms values to the Floors and the Floors
values to the selected Buildings values?
So far this is what I have done:

Private Sub Floors_GotFocus (Floors)
' Passing on the value of Buildings in order to display Floors
' only pertaining to selected Building.

Dim stLinkCriteria As String

strSQL = "Select [Floors] from tblLocations where [Building]=" &
Me![Building]

End Sub

Thank you.
Nov 12 '05 #1
5 2411
Hello
Create 3 combo boxes on your form (Form1): cmbBuildings, cmbFloors,
cmbRooms. Base these combo boxes on queries:
qryBuildings: SELECT DISTINCT tblLocations.Bu ildings FROM
tblLocations;

QryFloors: SELECT tblLocations.Fl oors FROM tblLocations
WHERE tblLocations.Bu ildings=[Forms]![Form1]![cmbBuildings];

QryRooms: SELECT tblLocations.Ro oms, tblLocations.Bu ildings,
tblLocations.Fl oors
FROM tblLocations WHERE
tblLocations.Bu ildings=[Forms]![Form1]![cmbBuildings] AND
tblLocations.Fl oors=[Forms]![Form1]![cmbFloors];

In OnGotFocus event of cmbFloors place:
Private Sub cmbFloors_GotFo cus()
cmbFloors.Reque ry
End Sub

In OnGotFocus event of cmbRooms place:
Private Sub cmbRooms_GotFoc us()
cmbRooms.Requer y
End Sub

This will do the trick.
Galina

el*****@miamida de.gov (Elvis V.) wrote in message news:<92******* *************** ****@posting.go ogle.com>...
Good morning, I have a table with three fields, Buildings, Floors and
Rooms.
This is what I would like to do; in my form when I select Building1 in
my drop down box for Buildings, when I go to the next drop down field
which is Floors, all I would like to see is just the floors that
belong to Building1 only and then once I have selected a value for
Floors, when I go to the next drop down field which is Rooms, all I
want to see are the rooms that belong only to the previous selected
Floor value, which belongs to that specific selected Building only.
Right now, when I go to my form and go to these fields what I get is
everything that there is in the table. I get to see all the Floors and
Rooms values for every building out there regardless of the value I
have selected for Buildings. How can I prevent this from happening?
How can I tight down the Rooms values to the Floors and the Floors
values to the selected Buildings values?
So far this is what I have done:

Private Sub Floors_GotFocus (Floors)
' Passing on the value of Buildings in order to display Floors
' only pertaining to selected Building.

Dim stLinkCriteria As String

strSQL = "Select [Floors] from tblLocations where [Building]=" &
Me![Building]

End Sub

Thank you.

Nov 12 '05 #2
Galina,
thank you for your reply.
I went ahead and did exactly as you told me. When I go to the form, the
cmbBuilding works fine, it gives me all the values in that field. Once I
select a value in Building and go to the cmbFloors, I just get a blank
field, no values displayed. What am I missing?
Thank you.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
Elvis
I have no possibility to know, what you are missing without looking at
your form. A spelling mistake? Have you swap Form1 in my code by the
name of your form? I can send you the form, which I have made when
preparing my answer, if you wish.
Galina
Elvis Vazquez <el*****@miamid ade.gov> wrote in message news:<3f******* *************** *@news.frii.net >...
Galina,
thank you for your reply.
I went ahead and did exactly as you told me. When I go to the form, the
cmbBuilding works fine, it gives me all the values in that field. Once I
select a value in Building and go to the cmbFloors, I just get a blank
field, no values displayed. What am I missing?
Thank you.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #4
Galina,
I got it. It was the way I had the cells formatted. I had it looking
into the second column instead of the first one, therefore it was
blank; there was nothing to be displayed on the second column.
Thank you very much and have a great weekend.
Elvis V

Elvis Vazquez <el*****@miamid ade.gov> wrote in message news:<3f******* *************** *@news.frii.net >...
Galina,
thank you for your reply.
I went ahead and did exactly as you told me. When I go to the form, the
cmbBuilding works fine, it gives me all the values in that field. Once I
select a value in Building and go to the cmbFloors, I just get a blank
field, no values displayed. What am I missing?
Thank you.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #5
ga*********@cit yofbristol.ac.u k (Galina) wrote in message news:<cc******* *************** ****@posting.go ogle.com>...
Elvis
I have no possibility to know, what you are missing without looking at
your form. A spelling mistake? Have you swap Form1 in my code by the
name of your form? I can send you the form, which I have made when
preparing my answer, if you wish.
Galina
Elvis Vazquez <el*****@miamid ade.gov> wrote in message news:<3f******* *************** *@news.frii.net >...
Galina,
thank you for your reply.
I went ahead and did exactly as you told me. When I go to the form, the
cmbBuilding works fine, it gives me all the values in that field. Once I
select a value in Building and go to the cmbFloors, I just get a blank
field, no values displayed. What am I missing?
Thank you.

Galina, thank you for your help. The problem was the way I had the drop
down boxes formatted. I fixed them and they are working like a charm.
Have a great day and thanks for your help.
Elvis V.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #6

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

Similar topics

0
1985
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is populated by sqlserver database table.When i select value from combobox ,value saved in to other table of my database and i use to datagrid to show...
10
13428
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group related to checkboxes. Thanks!!!
0
1823
by: Elvis V. | last post by:
Good morning, I have a table that contains three fields that I would like to relate one to another, in other words, for example, when I go to the form and I click on the drop down box for Buildings and select Building1, when I go to the following field Floors, I would like to only display the floor values that belong to Building1 so I can...
3
4019
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a table of customers, first column is the key field, which is hidden with a 0" width, and the second column is the customer name. The SQL is a union...
2
7039
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply. Each dynamically created...
8
2850
by: Lysander | last post by:
Hi, I am using Access 2003 I have seen some threads on how to select multiple values from a list box, but how do I display the selected options back again (Last time I used Access in anger, you could not multi-select at all) This is what I have. A demographic survey form, with over 100 questions, most of which can have multiple answers. At...
2
3083
by: giandeo | last post by:
Hello all, It's almost a couple of weeks since i am struggling to get this code work. Unfortunately, i am stuck. There seems to be no hope... Please Help....... I am working with an asp page that dynamically pulls info from my database to populate a drop down menu. Upon an onChange event, I wish to display the fields related to that...
1
2225
by: fsalvador | last post by:
Hi, I need help with this. I am trying to figure it out but I can't. I have 2 pages. I would like to display in the second page the content of one class and hide the content of the other classes. The idea is make the user to select a language, then display in the next page the content related to the selected option. This is the code I...
0
7767
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7684
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...
0
8006
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. ...
0
8196
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...
1
7768
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...
0
8058
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5579
isladogs
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...
1
1295
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1035
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...

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.