PC Review


Reply
Thread Tools Rate Thread

Combobox rows populated from different fields

 
 
Renster
Guest
Posts: n/a
 
      24th Jan 2007
Folks,

I have a table that is something like :

(key) Version number
StatisticName1 string
StatisticName2 string
StatisticName3 string
....

On a form I have a combobox that I wish to populate with the values in
StatisticName1, StatisticName2 etc, depending on the value of Version.
ComboboxName.RowSource = "SELECT StatisticName1, StatisticName2..."
doesnt work of course, as that treats the different stat names as
COLUMNS in the combo, not rows....

Help

TIA

Steve

 
Reply With Quote
 
 
 
 
Renster
Guest
Posts: n/a
 
      24th Jan 2007
Wayne,

I may have missed the point of what you wrote, but Im comfortable
writing queries like that. However, what I am trying to achieve is
different from the norm. Ordinarily a query such as the one you wrote
will return a recordset of "n" records from the one field
(TableName.FieldName). I wish to return a recordset made up of *1*
record from each of "n" fields.

eg:

(key)Reference Field1 Field2 Field3
--------------------------------------------------------------------
1 ref1f1 ref1f2 ref1f3
2 ref2f1 ref2f2 ref2f3
3 ref3f1 ref3f2 ref3f3

I want to populate a combobox such that, if for example I pass "where
Reference = 2" as a filter, the combobox is filled:

ref2f1
ref2f2
ref2f3

Hope this makes my problem a little clearer

Steve


On Jan 24, 9:31 am, Wayne-I-M <Wayn...@discussions.microsoft.com>
wrote:
> Hi
>
> Try something like
>
> SELECT [TabeName].[FieldName] FROM [TableName] ORDER BY [FieldName];
>
> --
> Wayne
> Manchester, England.
>
>
>
> "Renster" wrote:
> > Folks,

>
> > I have a table that is something like :

>
> > (key) Version number
> > StatisticName1 string
> > StatisticName2 string
> > StatisticName3 string
> > ....

>
> > On a form I have a combobox that I wish to populate with the values in
> > StatisticName1, StatisticName2 etc, depending on the value of Version.
> > ComboboxName.RowSource = "SELECT StatisticName1, StatisticName2..."
> > doesnt work of course, as that treats the different stat names as
> > COLUMNS in the combo, not rows....

>
> > Help

>
> > TIA

>
> > Steve- Hide quoted text -- Show quoted text -


 
Reply With Quote
 
=?Utf-8?B?V2F5bmUtSS1N?=
Guest
Posts: n/a
 
      24th Jan 2007
Sorry I though you were working on a form

>On a form I have a combobox that I wish to populate with the values in


Tom has given you the answer

Good luck with your project

--
Wayne
Manchester, England.



"Renster" wrote:

> Folks,
>
> I have a table that is something like :
>
> (key) Version number
> StatisticName1 string
> StatisticName2 string
> StatisticName3 string
> ....
>
> On a form I have a combobox that I wish to populate with the values in
> StatisticName1, StatisticName2 etc, depending on the value of Version.
> ComboboxName.RowSource = "SELECT StatisticName1, StatisticName2..."
> doesnt work of course, as that treats the different stat names as
> COLUMNS in the combo, not rows....
>
> Help
>
> TIA
>
> Steve
>
>

 
Reply With Quote
 
Renster
Guest
Posts: n/a
 
      25th Jan 2007
Tom,

Thanks very much for that, worked a treat.

Steve

On Jan 24, 10:25 am, Tom Wickerath <AOS168b AT comcast DOT net> wrote:
> Hi Steve,
>
> Your table does not appear to be properly normalized. However, perhaps
> basing your SELECT statement on a Union query will work for you.
>
> qUNIFieldValues (saved query)
>
> SELECT Reference, Field1 AS [FieldValue] FROM TableName
> WHERE Field1 is not null
> UNION
> SELECT Reference, Field2 AS [FieldValue] FROM TableName
> WHERE Field2 is not null
> UNION
> SELECT Reference, Field3 AS [FieldValue] FROM TableName
> WHERE Field3 is not null
> ORDER BY [FieldValue]
>
> For your combo box:
>
> SELECT [FieldValue]
> FROM qUNIFieldValues
> WHERE Reference = 2;
>
> Tom Wickerath
> Microsoft Access MVP
>
> http://www.access.qbuilt.com/html/ex...ml/search.html
> __________________________________________
>
>
>
> "Renster" wrote:
> > Wayne,

>
> > I may have missed the point of what you wrote, but Im comfortable
> > writing queries like that. However, what I am trying to achieve is
> > different from the norm. Ordinarily a query such as the one you wrote
> > will return a recordset of "n" records from the one field
> > (TableName.FieldName). I wish to return a recordset made up of *1*
> > record from each of "n" fields.

>
> > eg:

>
> > (key)Reference Field1 Field2 Field3
> > --------------------------------------------------------------------
> > 1 ref1f1 ref1f2 ref1f3
> > 2 ref2f1 ref2f2 ref2f3
> > 3 ref3f1 ref3f2 ref3f3

>
> > I want to populate a combobox such that, if for example I pass "where
> > Reference = 2" as a filter, the combobox is filled:

>
> > ref2f1
> > ref2f2
> > ref2f3

>
> > Hope this makes my problem a little clearer

>
> > Steve- Hide quoted text -- Show quoted text -


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combobox populated John Microsoft Access Form Coding 2 22nd Feb 2008 04:33 PM
ComboBox is populated but not visible. larpup Microsoft Access Form Coding 1 7th Jul 2006 12:30 AM
ComboBox is populated but not visible. larpup Microsoft Access Form Coding 0 6th Jul 2006 11:24 PM
ComboBox locks up when first populated =?Utf-8?B?cmVkaG9yc2U=?= Microsoft Powerpoint 5 28th Feb 2006 04:57 AM
ComboBox populated with indexes of a table Bob Microsoft Access VBA Modules 2 17th Feb 2004 06:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:49 AM.