944,193 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 1766
  • ASP RSS
Apr 3rd, 2006
0

From * Where =< in Access Database

Expand Post »
Hi,
I am really struggling to get this working. Im using an Access Database *.mdb in case that helps.

I am trying to check the database for stock levels, I would like to submit a number via a form, and have the database checked to see if the value is equal to or less than the number submitted. It should be straight forward, but I need help.

This Code works, but defeats the purpose:
rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity like '%" + Replace(rsResults__var1, "'", "''") + "%'"

I have also tried:

rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity < '%" + Replace(rsResults__var1, "'", "''") + "%'"

it doesnt work, neither does:

rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity =< '%" + Replace(rsResults__var1, "'", "''") + "%'"



Please stop me tearing my hair out someone.....
Joe
:cry:
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
charitiesonline is offline Offline
6 posts
since May 2005
Apr 3rd, 2006
0

Re: From * Where =< in Access Database

Just to clarify things in case they are unclear.
The first example:
rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity like '%" + Replace(rsResults__var1, "'", "''") + "%'"
Works in as much as it finds an exact match for the number submitted/searched for.
But the whole point is to be able to search for a number and have all the numbers that are equal to or less than it in that field found.

Even if you can help to just find the numbers that are less than the number searched for that will really help.


Quote originally posted by charitiesonline ...
Hi,
I am really struggling to get this working. Im using an Access Database *.mdb in case that helps.

I am trying to check the database for stock levels, I would like to submit a number via a form, and have the database checked to see if the value is equal to or less than the number submitted. It should be straight forward, but I need help.

This Code works, but defeats the purpose:
rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity like '%" + Replace(rsResults__var1, "'", "''") + "%'"

I have also tried:

rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity < '%" + Replace(rsResults__var1, "'", "''") + "%'"

it doesnt work, neither does:

rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity =< '%" + Replace(rsResults__var1, "'", "''") + "%'"



Please stop me tearing my hair out someone.....
Joe
:cry:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
charitiesonline is offline Offline
6 posts
since May 2005
Apr 3rd, 2006
0

Re: From * Where =< in Access Database

why are you treating quantity like it is a text field?
try this
ASP Syntax (Toggle Plain Text)
  1. rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity <= " +rsResults__var1
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005
Apr 3rd, 2006
0

Re: From * Where =< in Access Database

At last, Superb, Thanks so much.....
Joe
Reputation Points: 10
Solved Threads: 0
Newbie Poster
charitiesonline is offline Offline
6 posts
since May 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Getting a blank asp page
Next Thread in ASP Forum Timeline: Help - Wiindows





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC