Hello. I am facing a problem in access that cost me delay one week to submit my project of inventory database that I make it for computer device that used in our department.
I make combobox, name it(brand name)of computer company. other combobox that show you the model of computer. I want when user select the name of computer company then the next combobox of model display only the model of that company.
The problem is for example when I select hp copmany and I go to next combobox that will show me onle the model of hp but the model of hp for ex is :
1- dv5
2-dv6
3-pavilion 3847
when I select the second or third model then will only select the first one to fill the combobox so I need way to make combobox select any item of combobox.
I hope you understand to me.
Thank you.
13 3122
This requires VBA coding.
The recordsource of the second combo box (Combo2) would need to filter depending on the value of the first combo box (Combo1).
You could use the after update event of the first combo box to change the recordsource of the second combo box accordingly.
The code would be something like this: - Private Sub Combo1_AfterUpdate()
-
If Nz(Combo1, "") = "" Then
-
Combo2.RowSource = ""
-
Else
-
Combo2.RowSource = "SELECT Test2.ID, Test2.Field1 " _
-
& "FROM Test2 WHERE (((Test2.TestID) = " _
-
& [Forms]![Parameters]![Combo1] & ")) " _
-
& "ORDER BY Test2.Field1;"
-
End If
-
End Sub
If you need more specific code, please provide me with the current RowSource of your second combo box, the name of the form, and the names of the two combo boxes.
thank you steven to help me
i need specific code please
becuase i don't understrand the varible clearly hear
i don't understand the recordsource you want
do you mean the row source or the control source!!
the row source is Model Query
the control Source is Device Information_model
name of form is GQ Form
the first combobox name is BC
the secomd combobox name is MC
thank you...
NeoPa 32,556
Expert Mod 16PB
Why don't you play around with Example Filtering on a Form for a while. It should help you understand the issues clearly enough to handle this problem.
PS. Please do not request help via instant messaging. This is against site rules and will not be tolerated as it is inconsiderate of our experts.
You are right - I meant RowSource of the 2nd combobox MC.
Can you provide the SQL of "Model Query"? The code would be modified so that the Where clause restricts values according to the contents of the first combobox BC.
The code would be something like: - Private Sub BC_AfterUpdate()
-
If Nz(BC, "") = "" Then
-
MC.RowSource = ""
-
Else
-
MC.RowSource = "SELECT * " _
-
& "FROM [Model Query] WHERE (((BrandID) = " _
-
& [Forms]![GQ Form]![BC] & ")) " _
-
& "ORDER BY ModelName;"
-
End If
-
End Sub
-
If Model Query already has a filter that references [Forms]![GQ Form]![BC] then your code could be: - Private Sub BC_AfterUpdate()
-
MC.Requery
-
End Sub
-
hello
can any one tell me how i can make parameter read the value from combobox???
that the problem i faced now to i can filter the model!
NeoPa 32,556
Expert Mod 16PB
I'm sorry. What do you mean?
the answer of members doesn't help me
i try to find other way
i put the code of query
when i select the hp in brand name
and go to model
the window of parameter pop up so when i write hp in parameter filter the model
then only the model of hp shown
i whant make it read the parameter from brand name!
NeoPa 32,556
Expert Mod 16PB
Do you mean you'd like the Model ComboBox to be filtered such that it only shows those models that are relevant to the Brand?
If so, then that will involve filtering and referencing controls on your form. It's a bit difficult to proceed with you in that direction as you haven't told us any information that we would need, such as the names of your controls and how you have the form set up at the moment.
I can see that English is a bit of a problem for you. We can understand that. This information is not to do with language difficulties though. Just listing the names of the controls would be a good start.
Hi Aks 2010,
I notice you reposted your question, but in this thread you should be close to a solution.
Can you post the SQL for the query 'Model Query'? You wrote that Model Query is the rowsource for the 2nd combobox, named MC.
hi steven
the SQL of Model Query is: - SELECT Model.MCode, Model.BModel, Brand.BCode, Brand.[Brand Name]
-
FROM Brand INNER JOIN Model ON Brand.[Brand Name] = Model.Bcode;
---
yes that query for 2nd combobox but now named BM Q
becuse i make it with the table of brand name to i can filter that model
also the first combobox is related to the Brand Query
i hope you can help me with it
thank you...
For this to work the first combo box would be named BC, and it should contain the Brand.Bcode (even though it displays the brand). - Private Sub BC_AfterUpdate()
-
If Nz(BC, "") = "" Then
-
[BM Q].RowSource = ""
-
Else
-
[BM Q].RowSource = "SELECT Model.MCode, Model.BModel, Brand.BCode, Brand.[Brand Name] " _
-
& "FROM Brand INNER JOIN Model ON Brand.[Brand Name] = Model.Bcode " _
-
& "WHERE (((Brand.Bcode) = " & me.[BC] & ")) " _
-
& "ORDER BY Model.BModel;"
-
End If
-
End Sub
-
Hopefully this works for you.
NeoPa 32,556
Expert Mod 16PB
I would like to bring to the attention of anyone helping in here that the OP has created a new thread ( Filtering the two queries in two combobox) where they had hoped to get an answer to this same problem. With their general lack of willingness to respond to requests for information (or at all generally) I have no further interest in this thread on a technical level.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Phil Powell |
last post by:
The customer made a wild request: they want on their admin panel a
textarea that will display an existing resume.
This textarea, however, must have a dynamic width, one that "fills the
screen...
|
by: John Pether (john |
last post by:
Hi
I have a page that displays business listings. I have a repeater with dynamic text and in the 4th column I have an email and website link. Both display properly but I need to have one take...
|
by: JOSEPHINE ALVAREZ |
last post by:
I have this code that I want to use to do a rollover. However, because the
company I am doing it for is continually changing the text, I want to be
able to use dynamic text to change the text on...
|
by: gus kernot |
last post by:
I have copied code from the MS Knowledge Base that produces the above
report. I understand the code and am pretty comfortable working with
recordsets. I used the same report structure...
|
by: davidw |
last post by:
I found it seems there is a way to create a class with dynamic properties, I
don't really need define each property?
In ASP.NET, Profile is created with all profile items in web.config as its...
|
by: mk |
last post by:
Hi all,
The requirement is like this..
I have to update the table with the parameters from front end like at
some times i need to update one parameters and some times i have to
update more...
|
by: Ronald S. Cook |
last post by:
I've read a few posts on the stored procedure vs dynamic sql debate. I ran
a few performance test for myself and it appears to be a wash.
Given that, I'm leaning toward dynamic sql mostly...
|
by: Davilean |
last post by:
Hi,
I have got a combobox which directs to another page on select and when the submit button is clicked.
I am trying to change it into a dynamic combobox which redirects you to another page on...
|
by: sirsnorklingtayo |
last post by:
hi guys please help about Linked List,
I'm having trouble freeing the allocated memory of a single linked list node with a dynamic char* fields, it doesn't freed up if I use the FREE()...
|
by: CNSZU |
last post by:
Hello all,
Does anyone know how to attach a datasource to a combobox that resides in a toolstripdropdownbutton?
With fMain.ToolStripComboBox1.ComboBox
.DataSource = dv
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: 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...
|
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...
| |