Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    2

    Unanswered: Storing Entered Criteria for multiple queries

    is there a way to store what a user enters in a pop up box for use in multiple fields? what i have is a query with 2 different tables. i put a [pop up box] as the criteria for a field and would like to use what the user enters to search through both tables since both have the same field available in each, but different values in their remaining fields. im using Access XP. if it involves writing a small VB script could you walk me through that, as im not too familar w/ using VB inside of Access.

  2. #2
    Join Date
    Sep 2003
    Location
    UK
    Posts
    122
    Ok first please use full stops a little more as that was hard work to read.

    Create a module
    Code:
    Global SomeStuff as String
    
    Public Function ReturnMe as String
      ReturnMe=SomeStuff
    End Function
    Now use ReturnMe where ever you would like to search

    Like "*" & returnme() & "*" should be the criteria to search for the existance of the sting anywhere in the string being searched.

    Want more help msg here again
    Matt the Hat says: "what!?"
    A child of five could understand this! Fetch me a child of five!
    SCARY HARD CHALLENGE: http://www.dbforums.com/showthread.php?threadid=988682

  3. #3
    Join Date
    Sep 2003
    Posts
    2
    thanks for the reply, if you could go a little bit more in detail it would be helpful. i have created the module, but how do i put it in the design view of my query.

    As it stands now, this is my example.

    2 tables. 1) Cleveland 2) NCEC

    I want the user to input a certain Ward # into the pop up box. The query will then search the Cleveland Table and Display about 5 fields associated with that inputted Ward #.

    I also want it to display about 3 fields from the NCEC table also associated with that ward #.

  4. #4
    Join Date
    Sep 2003
    Location
    UK
    Posts
    122
    The user clicks the button to do it all

    Code:
    On_click
    
    'First get and store the number
    SomeStuff = InputBox("Whats the Ward #?")
    
    'Now Call Query
    DoCmd.RunQuery "FooBar"
    End Sub
    Now the critiria for the Ward

    =ReturnMe()

    Should solve it.

    BTW: If you want to display the results on a form open the form that is linked to the Query.

    In fact there is no special reason to do anything because the query will now display only the records for the number the user entered untill they get a chance to do so again OR you close the database.
    Matt the Hat says: "what!?"
    A child of five could understand this! Fetch me a child of five!
    SCARY HARD CHALLENGE: http://www.dbforums.com/showthread.php?threadid=988682

Posting Permissions

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