From * Where =< in Access Database

Reply

Join Date: May 2005
Posts: 6
Reputation: charitiesonline is an unknown quantity at this point 
Solved Threads: 0
charitiesonline charitiesonline is offline Offline
Newbie Poster

From * Where =< in Access Database

 
0
  #1
Apr 3rd, 2006
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:
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 6
Reputation: charitiesonline is an unknown quantity at this point 
Solved Threads: 0
charitiesonline charitiesonline is offline Offline
Newbie Poster

Re: From * Where =< in Access Database

 
0
  #2
Apr 3rd, 2006
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.


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:
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: From * Where =< in Access Database

 
0
  #3
Apr 3rd, 2006
why are you treating quantity like it is a text field?
try this
  1. rsResults.Source = "SELECT ProductID, SKU, ProductName FROM Products WHERE Quantity <= " +rsResults__var1
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 6
Reputation: charitiesonline is an unknown quantity at this point 
Solved Threads: 0
charitiesonline charitiesonline is offline Offline
Newbie Poster

Re: From * Where =< in Access Database

 
0
  #4
Apr 3rd, 2006
At last, Superb, Thanks so much.....
Joe
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for ASP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC