User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 426,568 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,632 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 1261 | Replies: 3
Reply
Join Date: May 2005
Posts: 6
Reputation: charitiesonline is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
charitiesonline charitiesonline is offline Offline
Newbie Poster

Help From * Where =< in Access Database

  #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:
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2005
Posts: 6
Reputation: charitiesonline is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
charitiesonline charitiesonline is offline Offline
Newbie Poster

Help Re: From * Where =< in Access Database

  #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  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: From * Where =< in Access Database

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

Re: From * Where =< in Access Database

  #4  
Apr 3rd, 2006
At last, Superb, Thanks so much.....
Joe
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP Forum

All times are GMT -4. The time now is 9:26 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC