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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Subform combo boxes



 
 
Thread Tools Display Modes
  #1  
Old February 4th, 2010, 12:00 PM posted to microsoft.public.access.forms
Mo[_7_]
external usenet poster
 
Posts: 7
Default Subform combo boxes

Hello,

I need to design a subform (in datasheet view), on which will be two
drop-down boxes and maybe a text box. The first combo is called
'categories' of which there are four types. The second combo is called
'symptoms'. A category can consist of many symptoms. This relation is
reflected at table-level.

Is it possible to have the first combo designed so that when the user
selects the category, the second combo shows only those symptoms
relevant to that category?

Sorry if this question has been asked before, but this is not something
I have experience with.

TIA for any help.
  #2  
Old February 4th, 2010, 12:35 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default Subform combo boxes

This is generally referred to as a cascading combo box. Here is a way to
implement this:

http://www.fontstuff.com/access/acctut10.htm

The second example is the one you need, I expect. The first one should not
be considered unless it uses named queries rather than tables. Considering
that there are just four categories this would not be a bad choice, but I
really don't think it is much easier. The second one is more versatile if
you add new categories.

Presumably you have tables something like this:

tblCategory
CatID (primary key, or PK)
Description
etc.

tblSymptom
SymptomID (PK)
CatID
Symptom

In the category combo box (cboCat), the stored value is CatID. In the After
Update event, something like:

Dim strSQL as String

strSQL = "SELECT [SymptomID], [Symptom] " & _
"FROM tblSymptom " & _
"WHERE [CatID] = " & Me.cboCat & _
" ORDER BY [Symptom]"

Me.cboSymptom.RowSource = strSQL

The above assumes the ID fields are Number fields. In both combo boxes, the
Row Count is 2, the Bound Column is 1 (that is, you are storing the ID, not
the text description of Category and Symptom), and the Column Widths are
something like 0";1.5". The cboCategory Row Source would be similar, except
without the WHERE, since you want to see all Category records.

Mo wrote:
Hello,

I need to design a subform (in datasheet view), on which will be two
drop-down boxes and maybe a text box. The first combo is called
'categories' of which there are four types. The second combo is called
'symptoms'. A category can consist of many symptoms. This relation is
reflected at table-level.

Is it possible to have the first combo designed so that when the user
selects the category, the second combo shows only those symptoms
relevant to that category?

Sorry if this question has been asked before, but this is not something
I have experience with.

TIA for any help.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201002/1

  #3  
Old February 4th, 2010, 12:48 PM posted to microsoft.public.access.forms
Mo[_7_]
external usenet poster
 
Posts: 7
Default Subform combo boxes

On 04/02/2010 12:35, BruceM via AccessMonster.com wrote:
This is generally referred to as a cascading combo box. Here is a way to
implement this:

http://www.fontstuff.com/access/acctut10.htm

The second example is the one you need, I expect. The first one should not
be considered unless it uses named queries rather than tables. Considering
that there are just four categories this would not be a bad choice, but I
really don't think it is much easier. The second one is more versatile if
you add new categories.

Presumably you have tables something like this:

tblCategory
CatID (primary key, or PK)
Description
etc.

tblSymptom
SymptomID (PK)
CatID
Symptom

In the category combo box (cboCat), the stored value is CatID. In the After
Update event, something like:

Dim strSQL as String

strSQL = "SELECT [SymptomID], [Symptom] "& _
"FROM tblSymptom "& _
"WHERE [CatID] = "& Me.cboCat& _
" ORDER BY [Symptom]"

Me.cboSymptom.RowSource = strSQL

The above assumes the ID fields are Number fields. In both combo boxes, the
Row Count is 2, the Bound Column is 1 (that is, you are storing the ID, not
the text description of Category and Symptom), and the Column Widths are
something like 0";1.5". The cboCategory Row Source would be similar, except
without the WHERE, since you want to see all Category records.



Thanks very for the response Bruce. I'll give it a try out and see how
it goes.

  #4  
Old February 4th, 2010, 01:16 PM posted to microsoft.public.access.forms
George
external usenet poster
 
Posts: 883
Default Subform combo boxes

Assuming that you have two tables (one to many) Categories and Symptoms then
on the lookout of sympltoms put something like the following as a criterion
under category
[Forms]![YourMainFormName]![YourSubformName].[Form]![YourCategoryField]

Also, have this textbox (lookup) to requery it self (i.e. after update of
the category field)

Hope this helps,

GeorgeCY

Ο χρήστης "Mo" *γγραψε:

Hello,

I need to design a subform (in datasheet view), on which will be two
drop-down boxes and maybe a text box. The first combo is called
'categories' of which there are four types. The second combo is called
'symptoms'. A category can consist of many symptoms. This relation is
reflected at table-level.

Is it possible to have the first combo designed so that when the user
selects the category, the second combo shows only those symptoms
relevant to that category?

Sorry if this question has been asked before, but this is not something
I have experience with.

TIA for any help.
.

 




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 12:30 PM.


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