Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Display a multi-column combo box in one field


Message #1 by Michelle Madden <MichelleM@a...> on Mon, 19 Mar 2001 10:47:56 -0000
Hi



Can anyone help?



Can a multi-column combo box be displayed in one field?  I have used a combo

box to display a list of contacts from the contacts table.



The columns selected are CONTACT_ID (Which is hidden, but is updating the

field in another table), TITLE, FIRST_NAME, LAST_NAME.



At the moment it displays the whole name but only selects the TITLE column.





I tried using the following expression in the control source

=[Forms]![Contact Information Main Menu]![Title] & " " & [Forms]![Contact

Information Main Menu]![First_name] & " " & [Forms]![Contact Information

Main Menu]![Last_name]   this displays the three columns but will not let me

select them and gives the following error :-



Control cannot be edited; it is bound by the expression =[Forms]![Contact

Information Main Menu]![Title] & " " & [Forms]![Contact Information Main

Menu]![First_name] & " " & [Forms]![Contact Information Main

Menu]![Last_name].



Any ideas?



Thanks



Michelle



Message #2 by Brian Skelton <brian_skelton@o...> on Mon, 19 Mar 2001 14:39:18 GMT
Michelle



A combo box can contain many columns, but it will only 

display them when the list is pulled down. The box only ever 

displays one of the columns. The way to get around this is 

put everything you want to display in one column.



Just change the Row Source of the combo box to something 

along these lines:



SELECT Table.Contact_ID, [Table]![Title] & " " & [Table]!

[first_name] & " " & [Table]![last_name] AS Full_Name FROM 

Table;



Basically, you just have to move the expression you created 

from the form and into the combo box query.



BDS



---- Original message ----

>Date: Mon, 19 Mar 2001 10:47:56 -0000

>From: Michelle Madden <MichelleM@a...>

>Subject: [access] Display a multi-column combo box in one 

field

>To: "Access" <access@p...>

>

>Hi

>

>Can anyone help?

>

>Can a multi-column combo box be displayed in one field?  I 

have used a combo

>box to display a list of contacts from the contacts table.

>

>The columns selected are CONTACT_ID (Which is hidden, but is 

updating the

>field in another table), TITLE, FIRST_NAME, LAST_NAME.

>

>At the moment it displays the whole name but only selects 

the TITLE column.

>

>

>I tried using the following expression in the control source

>=[Forms]![Contact Information Main Menu]![Title] & " " & 

[Forms]![Contact

>Information Main Menu]![First_name] & " " & [Forms]![Contact 

Information

>Main Menu]![Last_name]   this displays the three columns but 

will not let me

>select them and gives the following error :-

>

>Control cannot be edited; it is bound by the expression 

[Forms]![Contact

>Information Main Menu]![Title] & " " & [Forms]![Contact 

Information Main

>Menu]![First_name] & " " & [Forms]![Contact Information Main

>Menu]![Last_name].

>

>Any ideas?

>

>Thanks

>

>Michelle



Message #3 by Michelle Madden <MichelleM@a...> on Mon, 19 Mar 2001 21:44:34 -0000
Great .... Thanks Brian



I tried various ways of doing something along these lines but didn't quite

make it.  My knowledge of these statements is a little limited to say the

least.  



It now works fine.  I'm now onto the next!!!



Thanks again.



Michelle





-----Original Message-----

From: Brian Skelton [mailto:brian_skelton@o...]

Sent: 19 March 2001 14:39

To: Access

Subject: [access] Re: Display a multi-column combo box in one field





Michelle



A combo box can contain many columns, but it will only 

display them when the list is pulled down. The box only ever 

displays one of the columns. The way to get around this is 

put everything you want to display in one column.



Just change the Row Source of the combo box to something 

along these lines:



SELECT Table.Contact_ID, [Table]![Title] & " " & [Table]!

[first_name] & " " & [Table]![last_name] AS Full_Name FROM 

Table;



Basically, you just have to move the expression you created 

from the form and into the combo box query.



BDS



---- Original message ----

>Date: Mon, 19 Mar 2001 10:47:56 -0000

>From: Michelle Madden <MichelleM@a...>

>Subject: [access] Display a multi-column combo box in one 

field

>To: "Access" <access@p...>

>

>Hi

>

>Can anyone help?

>

>Can a multi-column combo box be displayed in one field?  I 

have used a combo

>box to display a list of contacts from the contacts table.

>

>The columns selected are CONTACT_ID (Which is hidden, but is 

updating the

>field in another table), TITLE, FIRST_NAME, LAST_NAME.

>

>At the moment it displays the whole name but only selects 

the TITLE column.

>

>

>I tried using the following expression in the control source

>=[Forms]![Contact Information Main Menu]![Title] & " " & 

[Forms]![Contact

>Information Main Menu]![First_name] & " " & [Forms]![Contact 

Information

>Main Menu]![Last_name]   this displays the three columns but 

will not let me

>select them and gives the following error :-

>

>Control cannot be edited; it is bound by the expression 

[Forms]![Contact

>Information Main Menu]![Title] & " " & [Forms]![Contact 

Information Main

>Menu]![First_name] & " " & [Forms]![Contact Information Main

>Menu]![Last_name].

>

>Any ideas?

>

>Thanks

>

>Michelle












___________________________________________________________________________

This message has been checked for all known viruses by MessageLabs Virus

Control Centre. If you receive any suspicious messages or attachments please

inform the Acorn I.T. Department immediately. 

___________________________________________________________________________



_________________________________________________________________________

"The information in this e-mail is confidential and may be legally

privileged. It is intended solely for the addressee. Access to this e-mail

by anyone else is unauthorised. If you are not the intended recipient, any

disclosure, copying, distribution or other action taken or omitted to be

taken in reliance on it, is prohibited and may be unlawful."



This message has been checked for all known viruses by MessageLabs Virus Control Centre. 

________________________________________________________________________

Message #4 by Manolis Manolas <mmsoft@r...> on Mon, 19 Mar 2001 14:02:16 -0800 (PST)



Hi Michelle.



Suppose that the table CIMM contains the fields 

CONTACT_ID, TITLE, FIRST_NAME, LAST_NAME.



The combo box [CB1] may have a record source as the following 

SELECT CIMM.CONTACT_ID, 

[TITLE] & "  " & [LAST_NAME] & "  " & [FIRST_NAME] AS EXPR1, 

CIMM.TITLE, 

CIMM.FIRST_NAME, 

CIMM.LAST_NAME 

FROM CIMM 

ORDER BY [TITLE] & "  " & [LAST_NAME] & "  " & [FIRST_NAME];



The columns of the combo box will be 5 but their lengths will be 

0cm;5cm;0cm;0cm;0cm

so that only EXPR1 will be shown (sorted ascending).



The value of the combo box is given by the first column in SQL, 

here CONTACT_ID. You write in the properties [bounded column 1].



You may use the value of any column (of a selected row) 

in your code remembering that in the code the counting 

of the combo columns starts from number zero. 

That means we have these five columns 

CONTACT_ID as column(0)

EXPR1 as column(1)

TITLE as column(2)

FIRST_NAME as column(3) and 

LAST_NAME as column(4).



Suppose that a text box [Txt2] on the same form with [CB1] 

must take as value the FIRST_NAME of 

the selected row of the combo box [CB1] when [CB1] loses focus. 

You write your code like this



Private Sub CB1_LostFocus()

Dim ctl As Control



Set ctl = Me![CB1]

Me![Txt2] = ctl.Column(3)



End Sub







I hope it is clear enough

Bye

Manolas Emmanuel





> -----Original Message-----

> From: Michelle Madden [mailto:MichelleM@a...]

> Sent: Monday, March 19, 2001 12:48 PM

> To: Access

> Subject: [access] Display a multi-column combo box in one field

> 

> 

> Hi

> 

> Can anyone help?

> 

> Can a multi-column combo box be displayed in one field?  I have 

> used a combo

> box to display a list of contacts from the contacts table.

> 

> The columns selected are CONTACT_ID (Which is hidden, but is updating

the

> field in another table), TITLE, FIRST_NAME, LAST_NAME.

> 

> At the moment it displays the whole name but only selects the 

> TITLE column.

> 

> 

> I tried using the following expression in the control source

> =[Forms]![Contact Information Main Menu]![Title] & " " &

[Forms]![Contact

> Information Main Menu]![First_name] & " " & [Forms]![Contact

Information

> Main Menu]![Last_name]   this displays the three columns but will 

> not let me

> select them and gives the following error :-

> 

> Control cannot be edited; it is bound by the expression

=[Forms]![Contact

> Information Main Menu]![Title] & " " & [Forms]![Contact Information

Main

> Menu]![First_name] & " " & [Forms]![Contact Information Main

> Menu]![Last_name].

> 

> Any ideas?

> 

> Thanks

> 

> Michelle





__________________________________________________

Do You Yahoo!?

Get email at your own domain with Yahoo! Mail. 

http://personal.mail.yahoo.com/


  Return to Index