By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,500 Members | 2,520 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,500 IT Pros & Developers. It's quick & easy.

Combo box refers to a combo box which refers to another combo box????

P: 17
I know how to get a combo box to refer to another combo box, but if I want to add a third which refers to the data in both of the previous two, it's not working.
Any ideas?
Nov 22 '06 #1
Share this Question
Share on Google+
24 Replies


NeoPa
Expert Mod 15k+
P: 31,186
I know how to get a combo box to refer to another combo box, but if I want to add a third which refers to the data in both of the previous two, it's not working.
Any ideas?
I'm afraid I'm going to have to refer you to the POSTING GUIDELINES: Please read carefully before posting to a forum as this makes no sense to me.
Nov 22 '06 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
I'm afraid I'm going to have to refer you to the POSTING GUIDELINES: Please read carefully before posting to a forum as this makes no sense to me.
As NeoPa says.

You will have to post the SQL code for the Row Source of the two combo boxes you currently have and explain what data and how you want the data to be viewed in the third.
Nov 22 '06 #3

P: 17
Thanks for your unhelp, I have read the posting guidelines thank you very much. This site is not user friendly at all and you offer no help to people who are just starting out in Access.
It is quite simple. I want to select the ship in the first box, the sailing date (only those for that ship) in the second, and the excursions on that date with that ship in the third.
Nov 23 '06 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
Thanks for your unhelp, I have read the posting guidelines thank you very much. This site is not user friendly at all and you offer no help to people who are just starting out in Access.
It is quite simple. I want to select the ship in the first box, the sailing date (only those for that ship) in the second, and the excursions on that date with that ship in the third.
allystone99

That is not most peoples experience of this site.

However, as we have tried to explain you haven't given us enough information to help you out.

We just don't understand your question, or what you want.

We are in fact trying to be very helpful by asking you for specific information that we know will help us to understand your problem instead of just ignoring you which most sites would have done.

I don't understand why this is such a problem for you.
Nov 23 '06 #5

P: 17
I'm afraid I'm going to have to refer you to the POSTING GUIDELINES: Please read carefully before posting to a forum as this makes no sense to me.
I don't see how this is helpful.
What information do you want from me? I have explained it the only way I know how.
Nov 23 '06 #6

NeoPa
Expert Mod 15k+
P: 31,186
Is the problem that English is not your first language?
Nov 23 '06 #7

P: 17
I find that comment offensive. The problem is that I am a beginner to Access. If you can't tell me what you need to know than how am I supposed to give you the info you need?
Nov 23 '06 #8

NeoPa
Expert Mod 15k+
P: 31,186
As a moderator on this site I cannot respond as I'd like to to your response.
Suffice to say, your demand for further assistance will go unanswered from me personally.
Bye.
Nov 23 '06 #9

P: 17
I really don't know what your problem is with my question. It is very simple.
I have a combo box. Yes? It has some information in it.
I have a second combo box. The information that appears in this list is dependant on what is selected in the first combo box. Do you follow so far?
Now I want to add a third combo box. The information in this one will be dependant on what is selected in the first two.
Please can you tell me how to do this.
Am I speaking Dutch or something? Why is this so hard for you to grasp?
Nov 23 '06 #10

MMcCarthy
Expert Mod 10K+
P: 14,534
As you admitted in previous posts you are a beginner in Access and I am trying to make allowances for that fact. However, your rude tone is not helping you.

As experts we are aware of the fact that there are numerous answers to your question depending on various factors. I am giving the following as just a small example of them:

Are your combo boxes based on queries/tables or value lists?

How and from where are you obtaining the values in your combo boxes?

What criteria are the dependencies based on?

Is your bound column an integer or a string?

Are your combo boxes bound or unbound to a field?

There are many more issues that can affect the answer to your 'simple' question. We were trying to be helpful and asked you to provide information that would have helped us to figure out the answers to these questions.

The experts on this site volunteer their time free of charge to help out others with the knowledge and experience they have gained over the years.

I'm afraid with your attitude they are going to be very unwilling now to help you out.

If you had just responded civilly to the first couple of posts realising that there must be a reason that these questions were being asked you would probably have the answer to your question by now.

Forum Moderator
Nov 23 '06 #11

Banfa
Expert Mod 5K+
P: 8,916
I really don't know what your problem is with my question.
The problem is that you are not providing any detail.

You have described your problem in English but you have not posted any of your existing code or any of your attempts so far to get the behaviour you require.

I have no doubt that the Experts in this forum can help you if you provide the information needed but you are doomed to get no-where if you provide no further detail.



Think on this, if you went to the garage because there was a problem with your cars headlights and asked them to tell you what the problem was without letting them see the car what do you think they would do?

Their most likely response would be they can't tell without seeing the car and please stop wasting their time.


Programming works the same way, in the majority of cases it is impossible to diagnose a problem without seeing the code in question.



If you really want help I suggest that you put what has happened in this thread so far behind you and post as much detail including code and SQL statements as you have about your problem.

Do not post only what you think is relevent, as you have already stated you are a novice and have got stuck on this problem. By definition this means you do not know what is relevent, Post everything.
Nov 23 '06 #12

P: 17
Thank you very much for actually taking the time to explain to me what you need to know from me. I do appreciate your help and while I don't believe in being rude, it was only in response to what was posted to me.

Are your combo boxes based on queries/tables or value lists?
They are based on a query

How and from where are you obtaining the values in your combo boxes?
I don't understand this, is this the same as the question above?

What criteria are the dependencies based on?

Is your bound column an integer or a string?

Are your combo boxes bound or unbound to a field?
I'm sorry but I don't understand most of these questions. I will try to be as clear as I can but I don't know anything about code or SQL.

I am trying to make a form where you select various criteria and it runs a report based on your criteria.
The report will show revenue and profit.
The criteria is Ship, Sailing Date, and Excursion Name.
I am stuck on getting the lists that appear in the combo boxes to only show data which is appropriate to what is selected in the previous combo box(es).

I have tried to do a print screen but my pc at work doesn't have Paint so I can't show you.
Nov 24 '06 #13

P: 17
You have described your problem in English but you have not posted any of your existing code or any of your attempts so far to get the behaviour you require.
I haven't written any code and I don't know where to look to find what you're looking for. :(
Nov 24 '06 #14

P: 17
I only started using Access a few months ago and in that time I have taught myself how to write queries, make reports and even very simple macros, but making forms is like learning a new language.
The help in Access is crap IMO, I can't get it to tell me anything that I need.
I have been trying for 3 days now to figure this out and I have tried very hard, the trouble is that no-one at work is any good at Access either, we are not programmers.
Nov 24 '06 #15

MMcCarthy
Expert Mod 10K+
P: 14,534
I only started using Access a few months ago and in that time I have taught myself how to write queries, make reports and even very simple macros, but making forms is like learning a new language.
The help in Access is crap IMO, I can't get it to tell me anything that I need.
I have been trying for 3 days now to figure this out and I have tried very hard, the trouble is that no-one at work is any good at Access either, we are not programmers.
allystone99,

We'll take it one step at a time and we'll get you to what you want to do.

Firstly, open the form in design view. Now right click on the first combo box and open the properties. Under the data tab. Copy and post whatever is in the following properties.

Row Source Type
Row Source
Bound Column

Do the same for the Second combo box.

Now tell me if I have the logic correct for the third combo box.

(sorry if you get two versions of this post as I missed a previous post by you and am changing the following accordingly.)

Ship, Sailing Date, and Excursion Name

You have a list of Ships in the first combo box. When you select a Ship you want to see a list of Sailing Dates in the second combo box and when you select a Sailing Date you want to see a list of Excursion Names in the third combo box.

We'll get to the report when we figure this out first.

If there is any other information you feel might be helpful please include it.

P.S. I have to go out in half an hour for a few hours (6 or 7), but I will return to this as soon as I get back. In the meantime, if it's urgent I will ask someone else to step in please let me know straight away.
Nov 24 '06 #16

P: 17
Thank you very much you are really helping.

The first box has this:
Row Source Type: Table/Query
Row Source: Select [Ship] From [Ships];
Bound Column: 1

The second:
Row Source Type: Table/Query
Row Source: Sailing dates
Bound Column: 1

The third:
Row Source Type: Table/Query
Row Source: SELECT [Wecs with calculations].[Excursion Name], [Wecs with calculations].[Excursion Number], [Wecs with calculations].Ship, [Wecs with calculations].Date, [Cruise Names].[Cruise Name] FROM [Cruise Names] INNER JOIN [Wecs with calculations] ON ([Cruise Names].[First Sailing] = [Wecs with calculations].Date) AND ([Cruise Names].Ship = [Wecs with calculations].Ship) AND ([Cruise Names].Cruise = [Wecs with calculations].[Cruise Number]) GROUP BY [Wecs with calculations].[Excursion Name], [Wecs with calculations].[Excursion Number], [Wecs with calculations].Ship, [Wecs with calculations].Date, [Cruise Names].[Cruise Name] HAVING ((([Wecs with calculations].Ship) Like IIf([Forms]![Report Menu]![ship] Is Not Null,[Forms]![Report Menu]![ship],"*")) AND (([Wecs with calculations].Date) Like IIf([Forms]![Report Menu]![Sailing date] Is Not Null,[Forms]![Report Menu]![Sailing date],"*"))) ORDER BY [Wecs with calculations].Ship, [Wecs with calculations].Date;
Bound Column: 1
Nov 24 '06 #17

P: 17
Should they all be running from the same source or doesn't it matter?
Nov 24 '06 #18

MMcCarthy
Expert Mod 10K+
P: 14,534
Change the row source for the third combobox to this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT [Wecs with calculations].[Excursion Name], [Wecs with calculations].[Excursion Number],
  3. [Cruise Names].[Cruise Name] 
  4. FROM [Cruise Names] INNER JOIN [Wecs with calculations] 
  5. ON ([Cruise Names].[First Sailing] = [Wecs with calculations].[Date]) 
  6. AND ([Cruise Names].Ship = [Wecs with calculations].Ship) 
  7. AND ([Cruise Names].Cruise = [Wecs with calculations].[Cruise Number]) 
  8. WHERE [Wecs with calculations].Ship Like IIf([Forms]![Report Menu]![ship] Is Not Null,[Forms]![Report Menu]![ship],"*") 
  9. AND [Wecs with calculations].[Date] Like IIf([Forms]![Report Menu]![Sailing date] Is Not Null,[Forms]![Report Menu]![Sailing date],"*") 
  10. GROUP BY [Wecs with calculations].[Excursion Name], 
  11. [Wecs with calculations].[Excursion Number], 
  12. [Wecs with calculations].Ship, 
  13. [Wecs with calculations].[Date], 
  14. [Cruise Names].[Cruise Name] 
  15. ORDER BY [Wecs with calculations].Ship, [Wecs with calculations].[Date];
  16.  
Then put a command button on the form. Cancel the wizard and open the properties.

Call it cmdFind (In the properties window under the other tab in name).

Then under the event tab go down to the On Click event.

Type in or show [Event Procedure] and click on the button with dots to the right.

The code editor will open and you will see the following:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdFind_Click()
  2.  
  3. End Sub
  4.  
Add the following line substituting the name of your 3rd combo box (found under the other tab in properties windows).

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdFind_Click()
  2.  
  3.    Me.Combobox3Name.Requery 
  4.  
  5. End Sub
  6.  
You should now see the correct list in the third combo box.

There are other ways of doing it but I think this is the easiest way for a beginner.

If you have any problems, let me know. I'll check in later.

Mary
Nov 24 '06 #19

P: 17
Thanks for your help Mary. Is there a way of doing the requery without making a command button?
Nov 27 '06 #20

MMcCarthy
Expert Mod 10K+
P: 14,534
Thanks for your help Mary. Is there a way of doing the requery without making a command button?
Because the value of the third combo box is based on the selection of both the other two combo boxes.

You could put the code in the After Update event of the second combo box but if the user changed the second combo box before the first this would cause an problem.

You could put the code in the after update event of both the first and second combo box but I'm not sure if this would work alright.

I chose the command button because I felt it was the best way to control it.

Mary
Nov 27 '06 #21

P: 17
Ok thanks. What would be the code that goes in the AfterUpdate of the second box? Do I need code in the AfterUpdate of the third box too?
Nov 28 '06 #22

MMcCarthy
Expert Mod 10K+
P: 14,534
Ok thanks. What would be the code that goes in the AfterUpdate of the second box? Do I need code in the AfterUpdate of the third box too?

It's the same code ....

Expand|Select|Wrap|Line Numbers
  1.  Me.Combobox3Name.Requery 
Just put it in the After Update Event of Combo's 1 and 2
Nov 28 '06 #23

P: 17
Hi Mary, I have tried this and it doesn't work. The command button didn't work either. It is showing the correct excursions for that ship but not for that date. Do you have any ideas?
Nov 29 '06 #24

MMcCarthy
Expert Mod 10K+
P: 14,534
Hi Mary, I have tried this and it doesn't work. The command button didn't work either. It is showing the correct excursions for that ship but not for that date. Do you have any ideas?
Are both [Sailing Date] and [Date] correctly formated as Date/Time data types.

Is the combo box returning a valid date?
Nov 29 '06 #25

Post your reply

Sign in to post your reply or Sign up for a free account.