Parameter Pop Up

jiajian

Registered User.
Local time
Today, 19:57
Joined
Sep 19, 2002
Messages
28
Hi

I have a table with [Name], [Address], [Tel No], [Date of Birth].

How can I view this table / query of personal information by key in the [Name] with Name 1 or / and Name2 or / and Name3……in a pop up dialog box. The number of Name depends on the requirement of cases. It is vary from time to time.

E.g I may enter 1 name & view the query or I may enter 5 name to view the query.

I presume a parameter query is require with the field [Name],…..(Next)…..(View).

Please advise how to do with this.

Thank you.

jiajian
 
Hi

Thanks. However, the example you show is not something that I am looking for.

What I am try to do is :

E.g:

Enter a name in a box (name1), press "Next", Enter the name in box again (name2), press "Next"....repeat until the require number of name (e.g 10).
Tha press "View", you will see 10 related record.

I hope this can explain my question clearer.

Hope to hear your reply.

Regards

jiajian
 
Isn't selecting easier and more user-friendly than typing each name and then clicking on Next?


Anyhow, with code you can achieve what you desired along these lines:-
Declare a form-module variable mCriteria on a form to hold the criteria. Place a text box on the form for the input of names, and put two command buttons on the form for the Next and View buttons.

Put code in the AfterUpdate event of the text box to put each input name in single quotes and add it to mCriteria, separating each name with a comma.

Put code in the OnClick event of the Next button to clear the text box.

Finally put code in the OnClick event of the View button to build an SQL statement, incorporating the variable mCriteria. The SQL statement should be in this format:
SQL = "SELECT * FROM TableName WHERE Name in (" & mCriteria & ")"

Create a query using the SQL statement and run the query.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom