473,323 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

combo box problems

Hi,

I am using Access 2003. I am having a problem with a pair of combo
boxes. I want the second one (cbo_service) to have it's row source
limited by the value I select in the first one (cbo_supplier). I have
added the criteria in the query for cbo_service that it is limited by
the value selected in cbo_supplier, using the full location of forms!
frm_x!cbo_service. However, when I click on the pull-down, it brings
up the select criteria dialog box. I put in an after update event to
show a message box with the value selected in cbo_supplier, and it
comes up fine. However, the value from cbo_supplier is not making it
to the query for cbo_service in time, if you see what I mean.

The background to this is that I have a main form, called frm_event.
This is based on a table which has the key event_id. In this there is
a subform which is based on a linking table which has the fields
link_id, event_id, supplier_id and service_id. When I type in the
name of the event on the main form, the event_id autonumber comes up
on the main form and is carried through to the event_id box in the
subform. I then go into the subform and select the supplier from
cbo_supplier, and the supplier_id number comes through fine. When I
then go into cbo_services, it asks me for the supplier_id with a
select criteria dialog box. If I remove the criteria, it lists all
the services for all suppliers. I need to limit it to the supplier
just selected in the previous combo box.

All help appreciated!

Thanks,

Franc.

Sep 18 '08 #1
2 1648
franc sutherland wrote:
Hi,

I am using Access 2003. I am having a problem with a pair of combo
boxes. I want the second one (cbo_service) to have it's row source
limited by the value I select in the first one (cbo_supplier). I have
added the criteria in the query for cbo_service that it is limited by
the value selected in cbo_supplier, using the full location of forms!
frm_x!cbo_service. However, when I click on the pull-down, it brings
up the select criteria dialog box. I put in an after update event to
show a message box with the value selected in cbo_supplier, and it
comes up fine. However, the value from cbo_supplier is not making it
to the query for cbo_service in time, if you see what I mean.

The background to this is that I have a main form, called frm_event.
This is based on a table which has the key event_id. In this there is
a subform which is based on a linking table which has the fields
link_id, event_id, supplier_id and service_id. When I type in the
name of the event on the main form, the event_id autonumber comes up
on the main form and is carried through to the event_id box in the
subform. I then go into the subform and select the supplier from
cbo_supplier, and the supplier_id number comes through fine. When I
then go into cbo_services, it asks me for the supplier_id with a
select criteria dialog box. If I remove the criteria, it lists all
the services for all suppliers. I need to limit it to the supplier
just selected in the previous combo box.

All help appreciated!

Thanks,

Franc.
Let's say you have Combo1 in the form MainForm. It's rowsource could be
Select OrderNumber, OrderDesc From Orders

The rowsource for Combo2 might be
Select OrderDetailID, Item, Qty From OrdDetail Where
OrderNumber = Forms!MainForm!OrderNumber

In the AfterUpdate event to Combo1 enter
Me.Combo2.Requery

The requery will synch the 2 together. It's possible your criteria for
Combo2 is incorrect or you aren't requerying.

Sep 18 '08 #2
On Sep 18, 7:02*pm, Salad <o...@vinegar.comwrote:
franc sutherland wrote:
Hi,
I am using Access 2003. *I am having a problem with a pair of combo
boxes. *I want the second one (cbo_service) to have it's row source
limited by the value I select in the first one (cbo_supplier). *I have
added the criteria in the query for cbo_service that it is limited by
the value selected in cbo_supplier, using the full location of forms!
frm_x!cbo_service. *However, when I click on the pull-down, it brings
up the select criteria dialog box. *I put in an after update event to
show a message box with the value selected in cbo_supplier, and it
comes up fine. *However, the value from cbo_supplier is not making it
to the query for cbo_service in time, if you see what I mean.
The background to this is that I have a main form, called frm_event.
This is based on a table which has the key event_id. *In this there is
a subform which is based on a linking table which has the fields
link_id, event_id, supplier_id and service_id. *When I type in the
name of the event on the main form, the event_id autonumber comes up
on the main form and is carried through to the event_id box in the
subform. *I then go into the subform and select the supplier from
cbo_supplier, and the supplier_id number comes through fine. *When I
then go into cbo_services, it asks me for the supplier_id with a
select criteria dialog box. *If I remove the criteria, it lists all
the services for all suppliers. *I need to limit it to the supplier
just selected in the previous combo box.
All help appreciated!
Thanks,
Franc.

Let's say you have Combo1 in the form MainForm. *It's rowsource could be
* * * * Select OrderNumber, OrderDesc From Orders

The rowsource for Combo2 might be
* * * * Select OrderDetailID, Item, Qty From OrdDetail Where
* * * * * * * * OrderNumber = Forms!MainForm!OrderNumber

In the AfterUpdate event to Combo1 enter
* * * * Me.Combo2.Requery

The requery will synch the 2 together. *It's possible your criteria for
Combo2 is incorrect or you aren't requerying.
Hi Salad,

You were right, the criteria for Combo 2 was wrong. When I built the
criteria using the expression builder within the query it writes out
the syntax differently I would use in the VB editor.

It writes it as:

[Forms]![frm_main]![frm_subform].[Form]![cbo_2]

So, because the combo boxes are in a subform, the referencing is
different?

Thanks, its working now.

All the best,

Franc.
Sep 18 '08 #3

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

Similar topics

1
by: FZ | last post by:
Hi Gang, I was wondering if a generous person might be able to walk me through what I believe is a pretty simple task. I actually have significant Access experience, but I haven't done it in...
1
by: Robert Neville | last post by:
The solution to my dilemma seems straight-forward, yet my mind has not been forthcoming with a direct route. My Project form has a tab control with multiple sub-forms; these distinct sub-forms...
1
by: meganrobertson22 | last post by:
Hi Everyone- I am trying to use a simple macro to set the value of a combo box on a form, and I can't get it to work. I have a macro with 2 actions: OpenForm and SetValue. I can open my form,...
2
by: Jason Huang | last post by:
Hi, Would someone tell me how to fill a dataset into a Combo Box? I need the ComboBox by default to show the first DataRow from the dataTable. Thanks for help. Jason
6
by: vb | last post by:
Hi, I am new to .Net. I am using a Combo Box in my windows forms. I am adding the items by creating the instances and adding the same to the list. My questions/doubts are: 1. If I have 25 to...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
9
by: Duncan Barnes-Ceeney | last post by:
I’m having problems with a custom Combo box. The main problem is that I want to modify the look of the combo which includes the size of the button. To do this I have inherited from the standard...
2
by: visionstate | last post by:
Hi there, I am working on a form that uses 3 text boxes and 3 combo boxes. When any data is entered into any of these, I click a command button and this requeries a sub query in the form and...
7
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table...
4
by: deanndra | last post by:
First, I want to say thank you to Scott and the others who replied to my first post here. I had to put that database on hold for the moment when I was tasked with a new one. I am building another...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.