Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    query a combo box (97)

    My problem is that I can't query on a field that is a combo box. Is there a better way to set this up? Can anyone look at this database and let me know if I should do something differently or why I can't query on the "Code" field? Thanks!
    Attached Files Attached Files

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: query a combo box (97)

    A couple of things to look at. Selecting Code SI as an example.

    1. In form design view, go to properties, Data, Recordsource and look at the query. Put the following in the criteria for code
    Like ([Forms]![Audit Form]![Code] & '*')
    to filter the form data based on the selection made.

    2. On the After Change event on the Code combo box add REFRESH to refresh the form with each selection made.

    3. The format for your form is set to Single. Selecting SI returns many results in the query / recordsource for the form so you only get one result. Change the format of your form to Continuous or put in additional filters as in number 1 above to reduce the resultant recordset for the form.

    HTH
    Regards,

    Gary
    (It's been a while!)

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: query a combo box (97)

    Your Audit Information table hase a field Code of type Text. The Codes table has a primary key of type AutoNumber, that is Numeric (Long Integer). This causes a type conflict. Changing the type of the Code field in the Audit Information table to Numeric (Long Integer) should solve the problem.

  4. #4
    New Lounger
    Join Date
    Aug 2001
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: query a combo box (97)

    Thanks for the ideas. I realized I had the combo box "bound" to column 1 in the Codes table - and column 1 was the primary key and set on autonumber. I meant to have the bound column be Column 2, which was the text I wanted to disply and store. So I changed the "bound" property to column 2 and everything is working fine! Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •