dbTalk Databases Forums  

How to display a multi-option list

comp.databases.ms-access comp.databases.ms-access


Discuss How to display a multi-option list in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
franc sutherland
 
Posts: n/a

Default How to display a multi-option list - 03-23-2010 , 10:38 AM






Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: How to display a multi-option list - 03-23-2010 , 10:55 AM






franc sutherland wrote:

Quote:
Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.
One method. You could use a listbox. Set the .Selected property to
true or false for the item. Set the listbox as MultiSelect or Simple so
you can select more than 1 row.

Reply With Quote
  #3  
Old   
Roger
 
Posts: n/a

Default Re: How to display a multi-option list - 03-23-2010 , 01:29 PM



On Mar 23, 10:38*am, franc sutherland
<franc.sutherl... (AT) googlemail (DOT) com> wrote:
Quote:
Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. *Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. *The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.
you could use a continuous subform to show the classifications, with a
checkbox indicating that a particular classification is assigned to
the customer
you just need to create a cross-product query (no joins) that always
returns all classificationId's

Reply With Quote
  #4  
Old   
franc sutherland
 
Posts: n/a

Default Re: How to display a multi-option list - 03-24-2010 , 06:03 AM



On Mar 23, 4:55*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
franc sutherland wrote:
Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. *Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. *The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.

One method. *You could use a listbox. *Set the .Selected property to
true or false for the item. *Set the listbox as MultiSelect or Simple so
you can select more than 1 row.
Hi Salad,
Thanks for your reply. I have set up the list box as Simple and can
select more than 1 row.
What should it's data source be? Should it have a control source?
Thanks,
Franc.

Reply With Quote
  #5  
Old   
franc sutherland
 
Posts: n/a

Default Re: How to display a multi-option list - 03-24-2010 , 06:09 AM



On Mar 23, 7:29*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote:
Quote:
On Mar 23, 10:38*am, franc sutherland



franc.sutherl... (AT) googlemail (DOT) com> wrote:
Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. *Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. *The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.

you could use a continuous subform to show the classifications, with a
checkbox indicating that a particular classification is *assigned to
the customer
you just need to create a cross-product query (no joins) that always
returns all classificationId's
Hi Roger,
Thanks for your reply,
How do I connect together the continuous forms showing the ten
classifications with the data in the x-ref table which lists the
classificationIDs against customerID?
Thanks,
Franc.

Reply With Quote
  #6  
Old   
Roger
 
Posts: n/a

Default Re: How to display a multi-option list - 03-24-2010 , 09:34 AM



On Mar 24, 6:09*am, franc sutherland <franc.sutherl... (AT) googlemail (DOT) com>
wrote:
Quote:
On Mar 23, 7:29*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote:





On Mar 23, 10:38*am, franc sutherland

franc.sutherl... (AT) googlemail (DOT) com> wrote:
Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. *Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. *The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.

you could use a continuous subform to show the classifications, with a
checkbox indicating that a particular classification is *assigned to
the customer
you just need to create a cross-product query (no joins) that always
returns all classificationId's

Hi Roger,
Thanks for your reply,
How do I connect together the continuous forms showing the ten
classifications with the data in the x-ref table which lists the
classificationIDs against customerID?
Thanks,
Franc.- Hide quoted text -

- Show quoted text -
assuming we have three tables,
tblCompany
customerId
customerName

tblClassification
classificationId
classification

tblCompanyClassification
customerId
classificationId

qryAllCC - this query is a cross-product (ie. no joins),
giving us all combinations of customer / classification

select customerId
, classificationId
from tblCompany
, tblClassification


qryCompanyClassification - this query gives all
classifications by customer, flagged which are assigned

select a.customerId
, a.classificationId
, iif(nz(b.customerId, "") = "", 0, 1) as assigned
from qryAllCC as a left join
tblCompanyClassification as b on a.customerId = b.customerId
and a.classificationId =
b.classificationId

Reply With Quote
  #7  
Old   
Salad
 
Posts: n/a

Default Re: How to display a multi-option list - 03-24-2010 , 10:08 AM



franc sutherland wrote:
Quote:
On Mar 23, 4:55 pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:

franc sutherland wrote:

Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.

One method. You could use a listbox. Set the .Selected property to
true or false for the item. Set the listbox as MultiSelect or Simple so
you can select more than 1 row.


Hi Salad,
Thanks for your reply. I have set up the list box as Simple and can
select more than 1 row.
What should it's data source be? Should it have a control source?
Thanks,
Franc.
I don't know. Are the customer classifications static? Or are the
classifications different based on a status type?

I might have a table of 10 classifications if static. Otherwise select
/present your classifications based on customer type. There you have a
list.

Then you'd have a table to store the selections. I might have a command
button to update the customer classifications once all classifications
are selected or create/update/delete a customer status record when the
row is selected/deselected.

'clears/sets all rows to unselected.
'ListType is name of control in example
Dim var As Variant
If Me.ListType.ItemsSelected.Count > 0 Then
For Each var In Me.ListType.ItemsSelected
Me.ListType.Selected(var) = False
Next
Endif

'selects the first row as true
Me.ListType.Selected(0) = True 'or set to false/unselected

You could enumerate the listbox. The following example will display all
rows in the listbox that are selected and at the end present a list of
all items in the listbox. It will select/display the second column (1
as the listbox is zero based) to the op. The listbox contains an ID
(col 0, hidden) and the value (col 1, visible).
Dim s As String
Dim i As Integer
For i = 0 To Me.ListType.ListCount - 1
If Me.ListType.Selected(i) Then
MsgBox Me.ListType.Column(1, i) & " is selected"
End If
s = s & Me.ListType.Column(1, i) & vbNewLine
Next
If s > "" Then MsgBox s

You could have a table with the customerid and customertype. Grab the
customer type from the listbox (col 0) and search the table for the type
and custid. If found, selected is true else false. Scan the list after
edit. If not selected, see if record exists and if so delete it. If
selected and rec now found, add it.

Using a listbox is one method in doing what you want.

Look at Selected, ItemsSelected, ListCount, Column in Help for examples
and clarification.

Reply With Quote
  #8  
Old   
franc sutherland
 
Posts: n/a

Default Re: How to display a multi-option list - 03-30-2010 , 09:50 AM



On Mar 24, 4:34*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote:
Quote:
On Mar 24, 6:09*am, franc sutherland <franc.sutherl... (AT) googlemail (DOT) com
wrote:



On Mar 23, 7:29*pm, Roger <lesperan... (AT) natpro (DOT) com> wrote:

On Mar 23, 10:38*am, franc sutherland

franc.sutherl... (AT) googlemail (DOT) com> wrote:
Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. *Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. *The ideais
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.

you could use a continuous subform to show the classifications, with a
checkbox indicating that a particular classification is *assigned to
the customer
you just need to create a cross-product query (no joins) that always
returns all classificationId's

Hi Roger,
Thanks for your reply,
How do I connect together the continuous forms showing the ten
classifications with the data in the x-ref table which lists the
classificationIDs against customerID?
Thanks,
Franc.- Hide quoted text -

- Show quoted text -

assuming we have three tables,
tblCompany
customerId
customerName

tblClassification
classificationId
classification

tblCompanyClassification
customerId
classificationId

qryAllCC - this query is a cross-product (ie. no joins),
giving us all combinations of customer / classification

select customerId
* * *, classificationId
* from tblCompany
* * *, tblClassification

qryCompanyClassification - *this query gives all
classifications by customer, flagged which are assigned

select a.customerId
* * *, a.classificationId
* * *, iif(nz(b.customerId, "") = "", 0, 1) as assigned
* from qryAllCC as a left join
* * * *tblCompanyClassification as b on a.customerId = b.customerId
* * * * * * * * * * * * * * * * * * and a.classificationId =
b.classificationId
Hi Roger,
Thanks for your explanation. I have tried to create the queries as
you suggested using the names I had already set up, but I got a list
of all the companies and all the classifications with a 0 in the
assigned column.

Here is the SQL from my version of qryCompanyClassification.

SELECT qry_all_cc.company_id , qry_all_cc.classification_id,
IIf(nz(tbl_company_classification.company_classifi cation_company_id,"")="",
0,1) AS assigned
FROM qry_all_cc LEFT JOIN tbl_company_classification ON
(qry_all_cc.classification_id =
tbl_company_classification.company_classification_ classification_id)
AND (qry_all_cc.company_id =
tbl_company_classification.company_classification_ company_id);

Could you tell me where I've gone wrong, please?

Many thanks,

Franc.

Reply With Quote
  #9  
Old   
franc sutherland
 
Posts: n/a

Default Re: How to display a multi-option list - 03-30-2010 , 10:23 AM



On Mar 24, 5:08*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
franc sutherland wrote:
On Mar 23, 4:55 pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:

franc sutherland wrote:

Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. *Each customer can fall into one or more of these ten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. *The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.

One method. *You could use a listbox. *Set the .Selected property to
true or false for the item. *Set the listbox as MultiSelect or Simpleso
you can select more than 1 row.

Hi Salad,
Thanks for your reply. *I have set up the list box as Simple and can
select more than 1 row.
What should it's data source be? *Should it have a control source?
Thanks,
Franc.

I don't know. *Are the customer classifications static? *Or are the
classifications different based on a status type?

I might have a table of 10 classifications if static. *Otherwise select
/present your classifications based on customer type. *There you have a
list.

Then you'd have a table to store the selections. *I might have a command
button to update the customer classifications once all classifications
are selected or create/update/delete a customer status record when the
row is selected/deselected.

* * *'clears/sets all rows to unselected.
* * *'ListType is name of control in example
* * *Dim var As Variant
* * *If Me.ListType.ItemsSelected.Count > 0 Then
* * * * For Each var In Me.ListType.ItemsSelected
* * * * * * * Me.ListType.Selected(var) = False
* * * * Next
* * *Endif * * *

* * *'selects the first row as true
* * *Me.ListType.Selected(0) = True *'or set to false/unselected

You could enumerate the listbox. *The following example will display all
rows in the listbox that are selected and at the end present a list of
all items in the listbox. *It will select/display the second column (1
as the listbox is zero based) to the op. *The listbox contains an ID
(col 0, hidden) and the value (col 1, visible).
* * *Dim s As String
* * *Dim i As Integer
* * *For i = 0 To Me.ListType.ListCount - 1
* * * * *If Me.ListType.Selected(i) Then
* * * * * * *MsgBox Me.ListType.Column(1, i) & " is selected"
* * * * *End If
* * * * *s = s & Me.ListType.Column(1, i) & vbNewLine
* * *Next
* * *If s > "" Then MsgBox s

You could have a table with the customerid and customertype. *Grab the
customer type from the listbox (col 0) and search the table for the type
and custid. *If found, selected is true else false. *Scan the list after
edit. *If not selected, see if record exists and if so delete it. *If
selected and rec now found, add it.

Using a listbox is one method in doing what you want.

Look at Selected, ItemsSelected, ListCount, Column in Help for examples
and clarification.
Hi Salad,

There are ten classifications in a table, tbl_classifications. There
is no additional segregation of the customers by, for instance, type.
Each of the companies will fit into at least one, and possibly, all
ten classifications.

These are linked to the specific companies with the table,
tbl_company_classifications, which has the fields
company_classification_id, company_id, classification_id.

I don't understand how to associate the data in
tbl_company_classifications with a 'simple' list box.
How would I update the data when the selections are changed?

Thanks for your help,

Franc.

Reply With Quote
  #10  
Old   
franc sutherland
 
Posts: n/a

Default Re: How to display a multi-option list - 03-30-2010 , 10:43 AM



On Mar 30, 4:23*pm, franc sutherland <franc.sutherl... (AT) googlemail (DOT) com>
wrote:
Quote:
On Mar 24, 5:08*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:



franc sutherland wrote:
On Mar 23, 4:55 pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:

franc sutherland wrote:

Hi,

I'm using Access 2003 on Windows XP.

My client wants to classify his customers according to ten
classifications. *Each customer can fall into one or more of theseten
classifications.

I want to display each of the possible ten classifications for each
customer record, and then highlight the ones that are applicable,
whilst keeping the others in place but not highlighted. *The idea is
to have a standard layout that is the same for each customer, so that
the user can identify just by the position of the highlighted whether
this customer has the appropriate classification.

I have set up the data with a company table, a classifications table
and a x-ref (cross-reference) table which has this sort of structure
x-refID, customerID, classificationID so that I can record more than
one classification per customer.

Are there any in-built tools that can do this?

The only thing I can think of is to list the ten possible
classifications as unbound text boxes, and then using the OnCurrent
event, loop through a recordset of the classificationIDs which are in
the x-ref table for that customerID and then highlighting the
appropriate text box with bold or a color or similar.

Thanks in advance,

Franc.

One method. *You could use a listbox. *Set the .Selected propertyto
true or false for the item. *Set the listbox as MultiSelect or Simple so
you can select more than 1 row.

Hi Salad,
Thanks for your reply. *I have set up the list box as Simple and can
select more than 1 row.
What should it's data source be? *Should it have a control source?
Thanks,
Franc.

I don't know. *Are the customer classifications static? *Or are the
classifications different based on a status type?

I might have a table of 10 classifications if static. *Otherwise select
/present your classifications based on customer type. *There you havea
list.

Then you'd have a table to store the selections. *I might have a command
button to update the customer classifications once all classifications
are selected or create/update/delete a customer status record when the
row is selected/deselected.

* * *'clears/sets all rows to unselected.
* * *'ListType is name of control in example
* * *Dim var As Variant
* * *If Me.ListType.ItemsSelected.Count > 0 Then
* * * * For Each var In Me.ListType.ItemsSelected
* * * * * * * Me.ListType.Selected(var) = False
* * * * Next
* * *Endif * * *

* * *'selects the first row as true
* * *Me.ListType.Selected(0) = True *'or set to false/unselected

You could enumerate the listbox. *The following example will display all
rows in the listbox that are selected and at the end present a list of
all items in the listbox. *It will select/display the second column (1
as the listbox is zero based) to the op. *The listbox contains an ID
(col 0, hidden) and the value (col 1, visible).
* * *Dim s As String
* * *Dim i As Integer
* * *For i = 0 To Me.ListType.ListCount - 1
* * * * *If Me.ListType.Selected(i) Then
* * * * * * *MsgBox Me.ListType.Column(1, i) & " is selected"
* * * * *End If
* * * * *s = s & Me.ListType.Column(1, i) & vbNewLine
* * *Next
* * *If s > "" Then MsgBox s

You could have a table with the customerid and customertype. *Grab the
customer type from the listbox (col 0) and search the table for the type
and custid. *If found, selected is true else false. *Scan the list after
edit. *If not selected, see if record exists and if so delete it. *If
selected and rec now found, add it.

Using a listbox is one method in doing what you want.

Look at Selected, ItemsSelected, ListCount, Column in Help for examples
and clarification.

Hi Salad,

There are ten classifications in a table, tbl_classifications. *There
is no additional segregation of the customers by, for instance, type.
Each of the companies will fit into at least one, and possibly, all
ten classifications.

These are linked to the specific companies with the table,
tbl_company_classifications, which has the fields
company_classification_id, company_id, classification_id.

I don't understand how to associate the data in
tbl_company_classifications with a 'simple' list box.
How would I update the data when the selections are changed?

Thanks for your help,

Franc.
Actually, some companies will fit in to none of the classifications.
Apologies,
Franc.

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.