Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Where clause 3

Status
Not open for further replies.

itmasterw

Programmer
Apr 13, 2003
147
US
Hi,
I want to be able to have the input of a textbox go to SQL statement as follows:

Set RS1 = DB.OpenRecordset("Select Sales_ID As hold From Funding_ShcedualWhere Sales_ID = " & Me!txtSaleID)
b = RS1!hold

The problem is that I can not get the Where clause to work. Could someone tell me what I am doing wrong. Thank You
 
looks like you need to put a space between the Funding_Shcedual and keyword Where. Your code currently looks like this:

Funding_ShcedualWhere
 
that was becase I typed it wrong here but in my actual code I have it seperated.
 
ok. When you say you can't get the where clause to work, what do you mean? Is there an error, or does it just seem to not see it, or what?
 
What's the data type of "Sales_ID"?

If its text then you need

Code:
Where Sales_ID = '" & Me!txtSaleID & "'"
 
Thanks for your help, this is driving me crazy
Sales_ID is a text, I tryed what you have above but it did not work. I think it is because I am not putting the perend in the right place. Where would I put this.
 
Copy and past Golom's code and run it that way. I think your "'" were wrong.
 
Hi itmaster,

I was wondering, if you get the value for Sales_ID from a textbox on a form, why on earth would you want that same value from a recordset?
Because in your snippet what you ask the table for is the exact same thing as what you put in as the criteria: DB.OpenRecordset("Select Sales_ID As hold From Funding_Shcedual Where Sales_ID = " & Me!txtSaleID)
The only thing this statement would do for you if it would work is confirm that the given value for Sales_ID is an actual value in the table.

Another thing I wondered about was this: have you tried to execute the statement without the where-clause? I can well imagine, for instance, that the actual table is named Funding_Schedual instead of Funding_Shcedual. Of course this sounds as if i think you're stupid but it is not meant like that - i have done far stupider things myself.

Hope you get it fixed,
Daniel Aaij
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top