Access Database Value Retrieval

  • Thread starter Sparky Arbuckle
  • Start date
S

Sparky Arbuckle

I have the following sql statement, typically it would grab a specific
value but I also want to be able to grab all values within the
database. Can I use the same SQL statement? I thought I could just use
* and pull everything but that doesn't appear to work.

SELECT tblRacers.RacerID, tblRacers.strLName, tblRacers.strFName,
tblRacers.strAgeCat, tblRacers.strRaceCat FROM tblRacers WHERE
tblRacers.strAgeCat='" & strAgeCat & "' AND tblRacers.strRaceCat='" &
strRaceCat & "';

I thought if the value passed in for strAgeCat/strRaceCat was * it
would pull all but I guess that isn't the case. Any suggestions on how
to approach this?

Thanks!
 
G

Guest

Hello

I don't know what you are stored in strAgeCat but you can form your query
like this.

SELECT tblRacers.RacerID, tblRacers.strLName, tblRacers.strFName,
tblRacers.strAgeCat, tblRacers.strRaceCat FROM tblRacers WHERE
tblRacers.strAgeCat like '% " & strAgeCat & "%' AND tblRacers.strRaceCat
like '%" &
strRaceCat & "'%" ;

However this is not the proper solution but we can fetch all the records
from the database not setting the value of strAgeCat/strRaceCat. I mean in
the absense of the values the query we shall have tblRacers.strAgeCat like
'%%' and so will get all the records.

I think it may work for you.

regards,
Bhavesh Patel
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top