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

the selection from combo box prints ID column instead of alpha dat



 
 
Thread Tools Display Modes
  #1  
Old May 8th, 2009, 03:55 PM posted to microsoft.public.access
dbuser
external usenet poster
 
Posts: 12
Default the selection from combo box prints ID column instead of alpha dat

I have created a combo box from table. Created query to select ID and column
containing title information. Use input form, combo box is choice to select
a code for potential candidate. When looking at table that data is input to;
noticed combo box data is the "ID" column number - not the column information
desired. Any help? Thanks very much in advance
  #2  
Old May 8th, 2009, 05:37 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default the selection from combo box prints ID column instead of alpha dat

On Fri, 8 May 2009 07:55:02 -0700, dbuser
wrote:

I have created a combo box from table. Created query to select ID and column
containing title information. Use input form, combo box is choice to select
a code for potential candidate. When looking at table that data is input to;
noticed combo box data is the "ID" column number - not the column information
desired. Any help? Thanks very much in advance


It's doing *exactly what it should be doing*. You want to store the ID in the
table.

If you want to see the text related to that ID on a Form use a combo box on
the form, bound to the ID field but displaying the text. If you want to see it
on a Report, it's better to base the report on a Query joining your main table
to the title information table.
--

John W. Vinson [MVP]
  #3  
Old May 8th, 2009, 05:42 PM posted to microsoft.public.access
[email protected]
external usenet poster
 
Posts: 129
Default the selection from combo box prints ID column instead of alphadat

That's how it should be. In a referencing table, i.e. one on the
'many' side of a one-to-many relationship a foreign key column
references the primary key of the referenced (one-side) table. In a
case like this the foreign key column is therefore a number data type
which corresponds to the numeric primary key of the referenced table.

The combo box's RowSource will return two columns, the ID column and
the text column, but by virtue of the control's ColumnWidths property
being set to something like 0cm;8cm (or equivalent in inches) the
first column is hidden (by being zero width) so you see the second
text column. The value of the control when a n item is selected,
however, is that of the hidden first column. The value is governed by
the control's BoundColumn property, which is by default 1.

As well as seeing the text value by means of a combo box like this you
can also see it by joining the referenced and referencing tables in a
query and returning the text column from the referenced table. This
is how its normally done in a report where a text box is then bound to
the text column, whereas in a form a combo box set up as described
above would more often than not be used.

If the dreaded 'lookup wizard' is used when setting the data type of a
column in table design it uses a combo box in this way as the columns
'display control'. However, it has unfortunate other consequences,
which you'll find detailed at:

http://www.mvps.org/access/lookupfields.htm

For this reason this feature should be avoided like the plague. You
can always hand-craft a combo box to act in this way in a form or use
the control wizard to set it up when designing a form. There is
nothing to be gained and much to be lost doing it in a table's
datasheet view, which should never be exposed to users in any case.

Ken Sheridan
Stafford, England

On May 8, 3:55 pm, dbuser wrote:
I have created a combo box from table. Created query to select ID and column
containing title information. Use input form, combo box is choice to select
a code for potential candidate. When looking at table that data is input to;
noticed combo box data is the "ID" column number - not the column information
desired. Any help? Thanks very much in advance


 




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 10:42 AM.


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