Drop Down boxes in Queries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • greeni91
    New Member
    • Nov 2009
    • 61

    #1

    Drop Down boxes in Queries

    Hi all,

    I am currently creating a database for use in my workplace. I am creating queries for this database at the moment and have came into a bit of a problem.

    I am trying to create queries using drop down lists so that the users of the database do not need to type and make mistakes to rum queries. This is all good until I came to doing drop down lists for lookup fields.

    I am wanting the query to show the lists with names in the lookup table but my input needs to be a number as it gives me an error with my code saying that the query cannot be opened in acViewNormal.

    I have created these queries using a form I have designed for dialog box use that is linked to the query which wants the inputs from the form to determine the criteria of the query.

    Can anyone help me, please

    /Sandy
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    I think you'll need to be clearer in your explanation Sandy. You lost me 2/3 of the way through.

    Maybe some examples in your explanation would help us (who cannot see what you're working on) to get a better picture in our heads of what you're struggling with.

    Comment

    • greeni91
      New Member
      • Nov 2009
      • 61

      #3
      Sorry,

      I am trying to make a query that uses a form with dropdown lists as its criteria. This seems to work until I come across a field that has been used as a lookup field in the main table.

      To query this information you need to use the number that is the primary key for the lookup table. This also means that my drop down list used on the form for the query will also show just the number from the primary key field.

      I was wanting to know if there is a way to use code to convert the numbers shown in my drop down box to the text that is associated with them whilst using that number in the query.

      It is all about the ease of using my form.

      /Sandy

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        That shouldn't be necessary. As long as you keep in mind what the value of the various controls (ComboBoxes) are. Once you realise the value can be different from what is displayed, the rest is fairly straightforward .

        By the way, the reason that I asked for example data is that it is still unclear exactly what you're trying to do, as there are two diffferent techniques that would be equally described by your explanation. One is to filter using references to the controls, and the other is to create filter strings in VBA using the values as returned by the controls. I still have no idea which you are trying to use, but my comment should hold true for both, regardless.

        It's a good tip though, that if you're asked for example data, to provide it. In fact, in most cases it's a good idea to provide what is requested by someone who's attempting to help you.

        Comment

        Working...