UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Listbox shows foreign key    
 
   
Praryboy
post Aug 24 2006, 03:37 PM
Post #1

UtterAccess Member
Posts: 44
From: Calgary, AB, Canada



Hey there! I have had this problem so many times, and I am hoping to get to the bottom of it, because I bet there is something very simple to fix it.

I have a listbox on my form, it has 2 columns, [Item Name], and [Category], both from an "Inventory" table. The [Category] column in the Inventory table, however, is actually a lookup to a "Category" table...

Now in my listbox in the category column, instead of saying "Tools" or "Consumables" for example, it instead shows "5" or "8", which is the Category ID number.... How do I make it say the category name instead of the category ID? I'm sure you will need more info, but I'm not sure what. heeeelp!
Go to the top of the page
 
+
fkegley
post Aug 24 2006, 03:45 PM
Post #2

UtterAccess VIP
Posts: 23,583
From: Mississippi



Change the column widths in the list box so that the first column width is 0.

Or you may need to flip flop the columns if the CategoryName is the first column.
Go to the top of the page
 
+
Praryboy
post Aug 24 2006, 03:54 PM
Post #3

UtterAccess Member
Posts: 44
From: Calgary, AB, Canada



The first column has a width of 0 already, the first column is the inventory ID (INVID) number. So I guess there are 3 columns in the listbox, INVID, Item Name, and Category. My problem is not that the CATID (Category ID) is visible, its that the Category column should say the category name, and not the CATID.


on a side note, the problem I think is that I used a lookup at the table level, and I am told that is bad... but I don't really know any other way to assign a category to an item.

Edited by: Praryboy on Thu Aug 24 17:01:33 EDT 2006.
Go to the top of the page
 
+
HelloAgain
post Aug 24 2006, 04:37 PM
Post #4

UtterAccess Guru
Posts: 703



What you want to do is create a query in the query builder using the Inventory and Category Table. Drag three fields into the query, INVID and [Item Name] from the inventory table and [Category Name] from the category table (I'm guessing at the Category Name field, you will have to change this to whatever it is. Make sure you drag the fields in that order. Save the query.

Then in the form's design view, in the listbox's rowsource property, type in the name of the query you just saved. The query should take care of the lookup for you.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 08:24 AM