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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query returns bank with expression used

Status
Not open for further replies.

stalo

Programmer
May 1, 2001
35
CY
I have developed a database for a hospital in Access 2003 that I have upsized only the tables. Some portions of it run smoothly but there some parts that do not.
The major problems until now are the following:
1. I am using true or false as boolean expression, but I have noticed that the SQL tables have turned true into YES and false into NO. Also when I click on the field table Yes becomes -1 and false becomes 0. How can I test use the following assignment:
srec.fields("CurrentBed") = True
also how do I test for a condition if it is true;
2. I have a query that while in Access was working fine now it returns no records. This query used this expression to provide all patients with the selected surname. What I am using is :
Like "*"&[Forms]![frmCurrentBed]![tect14]& "*"
Is this wrong? What can I use instead? Keep in mind that I have upsized only the tables and all the rest are local to each PC.
The same happens in a delete query where I have the expression forms!frmCurrentBed!BedID that returns no records. This worked OK with Access. What is the problem? Please help as I need to solve this asap.

I cannot thank enough anyone that can help me.

Thanks
Stalo

3.
 
In Access, wildcard searches use the * symbol. SQL Server uses the % symbol.

Like "%"&[Forms]![frmCurrentBed]![tect14]& "%"


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
George,
thank you for your answer. I am not at work at the moment but I will check it out tomorrow. Another thing is that some queries with expressions work, some do not. Could it be the joins? Should I make them simpler? I have upsized only the tables, is it relative?

I am new to SQL and everything looks hard to do.
 
Nothing in SQL is hard to do when you know how.

You've found the right forum in getting help. My suggestion would be to post your questions in this forum (a new thread for each question). I think you'll notice that most of the queries that worked properly in Access also work in SQL Server. Some will need tweaking. Work on those. Any that completely stump you should be posted in this forum. There are many folks here that are willing to help.

You'll find that learning SQL Server is worth the effort.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
SQL Server doesn't have forms, so this is unrecognized...
"*"&[Forms]![frmCurrentBed]![tect14]& "*"
SQL Server has no idea as to what you are asking for.

-SQLBill




Posting advice: FAQ481-4875
 
I assumed this was client side code to build a SQL query. If this code is trying to run on the database, then SQLBill is absolutely correct.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
No one seems to have mentioned this yet, so I'll had in my two copper pennies worth.

As far as your Boolean testing, I believe the -1 and 0 are an Access format for the True/False bit. In SQL, it is 1 = True and 0 = False.



Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top