A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combo Boxes



 
 
Thread Tools Display Modes
  #1  
Old January 7th, 2007, 01:35 PM posted to microsoft.public.access.gettingstarted
Andrew
external usenet poster
 
Posts: 8
Default Combo Boxes

I am fairly new to access, I am used to filemaker and PHP/MySQL
databases.

I am creating an ordering system where I have need for 2 combo boxes.
One to show a list of finishes based on the range chosen in a previous
box.

Combo Box one displays ranges of blinds based on a table of ranges

Combo Box two then looks up the available finishes based on the range
chosen.

I can get combo box one to function correctly, however i am having real
trouble getting box two to be dymanic.

Any help would be greatly appreciated

Regards,

Andrew

  #2  
Old January 7th, 2007, 02:09 PM posted to microsoft.public.access.gettingstarted
Nozza
external usenet poster
 
Posts: 39
Default Combo Boxes

On 7 Jan 2007 05:35:42 -0800, "Andrew"
wrote:

I am fairly new to access, I am used to filemaker and PHP/MySQL
databases.

I am creating an ordering system where I have need for 2 combo boxes.
One to show a list of finishes based on the range chosen in a previous
box.

Combo Box one displays ranges of blinds based on a table of ranges

Combo Box two then looks up the available finishes based on the range
chosen.

I can get combo box one to function correctly, however i am having real
trouble getting box two to be dymanic.

Any help would be greatly appreciated

Regards,

Andrew


Hi Andrew

Yes, the first combo is pretty straightforward if it is just based on
a table. And the second box is straightforward-ish too.

Have you gone down the route of using a query? That's the route I
would take.

Make sure the form is open - not in design view, and then create a new
query (I would use design view) for the available finishes table,
where the Criteria for the range is something like

[Forms]![frmOrder]![RangeID]

Once the query is working, then you can go back to the design of the
form and set the RowSource Type to be a Table/Query and RowSource to
be the query.

Hope that helps

Noz
--
Email (ROT13)

  #3  
Old January 7th, 2007, 03:05 PM posted to microsoft.public.access.gettingstarted
Andrew
external usenet poster
 
Posts: 8
Default Combo Boxes

I seem to have this working, however, when i change combo box 1 combo
box 2 does not update with a new list.

Any ideas?

Andrew

Nozza wrote:
On 7 Jan 2007 05:35:42 -0800, "Andrew"
wrote:

I am fairly new to access, I am used to filemaker and PHP/MySQL
databases.

I am creating an ordering system where I have need for 2 combo boxes.
One to show a list of finishes based on the range chosen in a previous
box.

Combo Box one displays ranges of blinds based on a table of ranges

Combo Box two then looks up the available finishes based on the range
chosen.

I can get combo box one to function correctly, however i am having real
trouble getting box two to be dymanic.

Any help would be greatly appreciated

Regards,

Andrew


Hi Andrew

Yes, the first combo is pretty straightforward if it is just based on
a table. And the second box is straightforward-ish too.

Have you gone down the route of using a query? That's the route I
would take.

Make sure the form is open - not in design view, and then create a new
query (I would use design view) for the available finishes table,
where the Criteria for the range is something like

[Forms]![frmOrder]![RangeID]

Once the query is working, then you can go back to the design of the
form and set the RowSource Type to be a Table/Query and RowSource to
be the query.

Hope that helps

Noz
--
Email (ROT13)


  #4  
Old January 7th, 2007, 03:21 PM posted to microsoft.public.access.gettingstarted
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Combo Boxes

Andrew wrote:
I seem to have this working, however, when i change combo box 1 combo
box 2 does not update with a new list.

Any ideas?


In the AfterUpdate event of ComboBox1 you need to use code to Requery
ComboBox2...

Me!ComboBox2.Requery

You will likely need that same code in the Current event of the form so that
ComboBox2's list will also adjust as you move from record to record.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #5  
Old January 7th, 2007, 07:28 PM posted to microsoft.public.access.gettingstarted
Andrew
external usenet poster
 
Posts: 8
Default Combo Boxes

Thank you for this.

I do not understand where the:

Me!

Comes from?

Regards,

Andrew

Rick Brandt wrote:

Andrew wrote:
I seem to have this working, however, when i change combo box 1 combo
box 2 does not update with a new list.

Any ideas?


In the AfterUpdate event of ComboBox1 you need to use code to Requery
ComboBox2...

Me!ComboBox2.Requery

You will likely need that same code in the Current event of the form so that
ComboBox2's list will also adjust as you move from record to record.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #6  
Old January 7th, 2007, 07:37 PM posted to microsoft.public.access.gettingstarted
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Combo Boxes

Andrew wrote:
Thank you for this.

I do not understand where the:

Me!

Comes from?


Me is a shorthand reference to the containing class object of the code being
run. So when the code is in a form's module Me refers to the form, if in a
report's module then it refers to the report.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #7  
Old January 7th, 2007, 07:53 PM posted to microsoft.public.access.gettingstarted
Andrew
external usenet poster
 
Posts: 8
Default Combo Boxes

So by writing a macro which runs Requery then put combobox2 in the
control name box this should work?

Andrew

Rick Brandt wrote:

Andrew wrote:
Thank you for this.

I do not understand where the:

Me!

Comes from?


Me is a shorthand reference to the containing class object of the code being
run. So when the code is in a form's module Me refers to the form, if in a
report's module then it refers to the report.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #8  
Old January 7th, 2007, 08:01 PM posted to microsoft.public.access.gettingstarted
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Combo Boxes

Andrew wrote:
So by writing a macro which runs Requery then put combobox2 in the
control name box this should work?


Sounds right. I don't use macros so I can't comment with certainty.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #9  
Old January 7th, 2007, 08:09 PM posted to microsoft.public.access.gettingstarted
Andrew
external usenet poster
 
Posts: 8
Default Combo Boxes

Ok, I have created code for the form as follows

Option Compare Database

Private Sub Form_Current()

Me!Finishes.Requery

End Sub

Private Sub VenRange_AfterUpdate()

Me!Finishes.Requery

End Sub

Finishes is the name of combo box2 VenRange is the name of combo box1

This does not appear to be working. I still have to press f9 to refresh
the combobox2

Am I being dense?

Andrew
Rick Brandt wrote:

Andrew wrote:
So by writing a macro which runs Requery then put combobox2 in the
control name box this should work?


Sounds right. I don't use macros so I can't comment with certainty.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #10  
Old January 7th, 2007, 08:22 PM posted to microsoft.public.access.gettingstarted
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Combo Boxes

Andrew wrote:
Ok, I have created code for the form as follows

Option Compare Database

Private Sub Form_Current()

Me!Finishes.Requery

End Sub

Private Sub VenRange_AfterUpdate()

Me!Finishes.Requery

End Sub

Finishes is the name of combo box2 VenRange is the name of combo box1

This does not appear to be working. I still have to press f9 to
refresh the combobox2

Am I being dense?


It is not enough to write the code. You also have to set the Event Properties
to [Event Procedure]. That is what causes the code to be run at the appropriate
times. Right now your code is just sitting there never being called.

In form design view bring up the properties sheet and click on the Events tab.
In the On Current property box of the form enter [Event Procedure]. Do the same
in the After Update property of the VenRange control. Then it should work.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.