variable input failing (1 Viewer)

notes1952

New member
Local time
Today, 09:00
Joined
Dec 8, 2010
Messages
2
Hi all - I have built a query and am using the expression builder to create a variable input. I am wishing to select records which match membership numbers which are manually input. I have set the criteria up as [enter membership number] or [enter membership number] or [enter membership number] or [enter membership number] but after only accepting 2 entries it exits and displays just those 2. Is there a way of doing it so that I can manually enter 14 membership numbers?
 

stopher

AWF VIP
Local time
Today, 00:00
Joined
Feb 1, 2006
Messages
2,395
Welcome to the forum.

I think you would have to uniquely define each entry script e.g.

Code:
[enter 1st membership number] or [enter 2nd membership number] or [enter 3rd membership number] or [enter 4th membership number]

However, I think this is the wrong approach if the user has to enter potentially 14 numbers. The user would have to concentrate on making sure every entry was correct and that they hadn't missed one (bearing in mind they have no way of reviewing what they've entered so far). I wonder how many times the user would get it wrong and have to start over.

Instead I would add an input box on a form (continuous to allow for 14 entries) which stores to a table. Then just write your query to join with this table.

hth
Chris
 

notes1952

New member
Local time
Today, 09:00
Joined
Dec 8, 2010
Messages
2
Hi Chris,

Thanks for the quick response. I altered my current code as you suggested & it fixed my issue. I will look further at the idea of an input box. Thanks again.
 

John Big Booty

AWF VIP
Local time
Today, 09:00
Joined
Aug 29, 2005
Messages
8,263
Here's another solution. It uses an unbound form with two text boxes. The member numbers you wish to search on are entered into a visible text box, each separated by a comma.

When the search button is pressed the text, is passed to the second (hidden) text box, where it is formatted into a form compatible with an SQL Where criteria. This is then used in an SQL statement that forms the Record Source for a second form which is opened to display the search results.

There are a number of problems with this method;
  1. It relies on the user knowing the Member numbers they wish to search on,
  2. It relies on the user correctly typing the numbers they wish to search on,
  3. It currently has no validation to ensure that valid member numbers have been input by the user.
 

Attachments

  • db2.zip
    32.8 KB · Views: 67
Last edited:

Users who are viewing this thread

Top Bottom