A Select all

L

L

I have a drop down on my site with a list of states. I've added an option for
"Select All". Everything is working fine, when you select a state, the
appropriate information for that state is populates. How do I make the
"Select All" selection to work?
 
K

Kevin Spencer

How do I make the
"Select All" selection to work?

Define "work." What do you want it to do?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
L

L

If a user clicks on "Select All", I want all the records in the database to
be displayed.
 
K

Kevin Spencer

How does it fetch data from the database now?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
L

L

Based on the drop down select. If a user selects "Alabama" from the drop
down, All the records for Alabama will be displayed and so on. But now, I
need to add an option for a user to select "Select All" and for all the
records to be displayed.

I am using the database results wizard to accomplish this task.
 
K

Kevin Spencer

In your case, probably the easiest thing to do would be to create a
selection in your drop-down list box that has text reading "All" (or
whatever), and make the value of it '%' (SQL wildcard character). I'm
assuming that your query has a WHERE clause that plugs in the state name
from the drop-down, something like:

SELECT * FROM MyTable WHERE State = 'AL'

If you plug in the '%' (wildcard) into the statement, it becomes:

SELECT * FROM MyTable WHERE State = '%'

The wildcard indicates that anything matches, so all states would be
returned.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
L

L

Hi Kevin,

<option value= "%" >Select All</option>
That's what I have for my Select All value and it's still displaying the No
records found message. I using an Access database for this query. I don't
think that matters.
 
K

Kevin Spencer

Well, L,

I don't know what your query looks like. I guessed.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
L

L

Here's the statement from FrontPage:
fp_sQry="SELECT * FROM tblCompany WHERE (ContactState = 'D1')"
D1 being the name of my dropdown
 
K

Kevin Spencer

I don't use the DRW, but I believe that should be:

fp_sQry="SELECT * FROM tblCompany WHERE (ContactState LIKE '::D1::')"

Your first query should not return anything, as it is looking for a state
named "D1". Also, I'm not sure whether Access requires LIKE with a wildcard,
but it won't hurt.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top