Results 1 to 15 of 15
  1. #1
    zachc94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    7

    Question Column in listbox displaying bound column values rather than display column values

    So I have a form asking for Country, and I have a list of all of the countries. I then am performing a query to filter through the countries. I then have a button that I click to perform the query and then unhide a listbox showing the details of the rest of the record. However in the listbox under the title "country" it shows a number value rather than displaying the name of the country. Anyway to show the display value instead ?

    Need help ASAP

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    you need to set some of your listbox properties

    1. set the number of columns to the number required
    2. set the column widths - if you only want to hide the first numeric column, just put 0. If you need to set anything other than deufalt widths then you need to set them all - so for example for 4 columns you might have 0,2,4,3

  3. #3
    zachc94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    7
    Hey,
    I don't want to hide the column showing the numerical value. The column is currently showing the countryID rather than showing the country value. When I look in the qryfiltercountry it displays the full country (for example India). On the form with the listbox that gets its information from qryfiltercountry it displays "62" instead of displaying "India". Is there a way for me to make it display "India" rather than the countryID "62".
    Does this make sense?

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    Does this make sense?
    No - perhaps if you tell me why my suggestion doesn't do what you want, it will make more sense

  5. #5
    zachc94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    7
    If I extend the column width of the Country column in the listbox the country ID (the number value) still shows up rather than the name of the country. Changing the column widths doesn't change that it is not showing me the name of the country, rather it is showing me the number of the country in the database. For example India is being showed as 62 instead of "India" in the country column of the listbox.

  6. #6
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    when you say 'If I extend the column width of the Country column in the listbox' what do you mean?

  7. #7
    zachc94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    7
    I mean for "Column Width" in the Property sheet I made it more than 1" like how you recommended earlier.
    2. set the column widths - if you only want to hide the first numeric column, just put 0. If you need to set anything other than deufalt widths then you need to set them all - so for example for 4 columns you might have 0,2,4,3

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    @zach,

    Readers have no idea about your business, you , your form and controls, or the issue you are facing.

    You have to give readers a description in simple English, no jargon, no assumptions terms.

    Sounds like you may:

    -have a form with a combo or
    -have used a lookup field at the table field level.

    Readers need more info. Be clear and be sure to overview your environment and the issue.

    like how you recommended earlier.
    If this refers to a different post, then please identify this for readers.

  9. #9
    zachc94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    7
    I will try my best.
    I have a form with a combobox. This combobox has all of the Countries in the world in it. I have a table that contains different fields. One of these fields is country. The form I have is made so I can search for users. I have made a query to search for country using the combobox. I have a command button that when I click it performs a requery then it unhides a listbox which has all of the columns that are in the table. Under the Country title (in the listbox) instead of actually saying the name of the country it says a number. The number correlates with the country. India is number 62. The listbox shows 62, I want it to be able to show India (like in the table, and in the query). Is there any way to make the listbox show the country name, rather than the number?

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,824
    Combobox properties:
    RowSource: SELECT ID, Country FROM Countries;
    ColumnCount: 2
    ColumnWidths: 0";1.0"
    BoundColumn: 1

    Listbox properties would be similar. Just adjust the ColumnCount and ColumnWidths properties for however many fields are included in the RowSource.


    Why are you using a listbox for the countries when you already have a combobox for the countries?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    What is the rowsource of the combobox?

    When you are dealing with all of the countries of the world, you might consider using an international standard code such as ISO 3166 or UN Countries and Regions. The sources for these are maintained.

    If you have a Lookup table with fields CountryId, CountryName
    you would use the numeric 62 to find the record in the lookup table and you would return the Country Name.

    Here is a similar post that may be helpful.

    Good luck.

  12. #12
    zachc94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    7
    I am using the listbox purely as a method of displaying the records after I perform the query with the criteria coming from the combobox which lists all of the countries.

  13. #13
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,824
    So the listbox will show only one record? This will require code in the combobox AfterUpdate event to requery the listbox.

    Alternative that does not require code is to include all fields in the combobox RowSource and then have textbox ControlSource property reference combobox column index:

    =[comboboxname].[Column](1)
    =[comboboxname].[Column](2)
    etc
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    zachc94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    7
    The row source of the combobox is SELECT tblcountries.ID, tblcountries.F1 FROM tblcountries ORDER BY tblcountries.F1;

    The row source of the listbox is SELECT qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[First Name:], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[Last Name:], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[Job Title:], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[Expertise:], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[Country of Office:], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[City of Office:], qryfiltercountryandlanguage.qryfiltercountry.qryse arch2.[Fluent in English?], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[First Language:], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[Second Language:], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[Contact Number:], qryfiltercountryandlanguage.[qryfiltercountry].[qrysearch2].[Contact Email:] FROM qryfiltercountryandlanguage;

    When I select "India" in the combo box and click "Filter by country" command button it runs the query and then displays a listbox containing all of the records with the country India. The problem is, instead of saying "India" it says the number 62. The thing that is strange, is that when I open the query (after I have clicked "Filter by Country" command button) it shows the country in the field "Country" as "India" and not 62. So why does the listbox revert back to using the number 62 rather than what is in the "Country Field" in the query ?

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,824
    I NEVER use dynamic parameterized queries, which is what you appear to base the listbox on.

    I suspect that query is not pulling the correct field for the country name. It is probably pulling a lookup field.

    I NEVER build lookups in tables because they cause this kind of confusion.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 02-27-2012, 09:50 AM
  2. Replies: 1
    Last Post: 12-08-2011, 08:03 AM
  3. Replies: 2
    Last Post: 12-05-2011, 04:53 AM
  4. Replies: 3
    Last Post: 09-28-2011, 04:29 PM
  5. inserting values in column based another column
    By wasim_sono in forum Database Design
    Replies: 1
    Last Post: 06-27-2006, 05:23 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums