|
-
April 9th, 2004, 09:25 AM
#1
VBA SQL Select (Code included)
Hi all,
I have this bit of SQL that I can't get working.
rst1.Open "SELECT Studenten.* FROM Studenten WHERE (((Studenten.Printen) Is Null) AND ((Studenten.VerzendenNaar) Is S));"
I know the first part is proper untill ....((Studenten.VerzendenNaar) Is S));" is proper but I can't seem to get the end right. If the field VerzendenNaar in the table Studenten has an S in it I wan't it to select it.
Pretty please with suggar on top tell me what I am doning wrong. (Probably simple as pie)
Thank you all and have a nice easter!
Jasper
Flying is to throw yourself on the ground and miss
-
April 9th, 2004, 09:46 AM
#2
Code:
rst1.Open "SELECT Studenten.* FROM Studenten WHERE (((Studenten.Printen) Is Null) AND ((Studenten.VerzendenNaar) ='S'));"
use is when comparing to null
use = with numbers , strings
-
April 9th, 2004, 09:56 AM
#3
First of all let me thank you for your time and effort.
Thank you very much for explaining. Maybe you can telle me something else I have A question about.
My piece of code is reffering to a table, is it possible to make a selection from a query? I can't seem to get it right.
Best regards,
Jasper
Flying is to throw yourself on the ground and miss
-
April 9th, 2004, 10:02 AM
#4
My piece of code is reffering to a table, is it possible to make a selection from a query? I can't seem to get it right.
yes you can save a query in access and select from it (query it)
also in SQL Server you can save a query as a view and select from it.
if you are using access open a new query .. write your select statement (or use the query builder) then save it..
in your code you can say :
Select * from Query1 where ......... etc.
-
April 9th, 2004, 10:04 AM
#5
Or.... use nested Select statements [SQL Server and other "real" DBMS for this, Access has problems with it!]
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
April 9th, 2004, 10:09 AM
#6
Originally posted by TheCPUWizard
Or.... use nested Select statements [SQL Server and other "real" DBMS for this, Access has problems with it!]
yes . nested queries are options..but using views can increase performance and decrease the complexity of the query.
I also used sub queries in access..not bad till now
-
April 13th, 2004, 01:58 AM
#7
Hello hspc and THECPUWizard,
Thank you again for your time and effort to answer my question, I had weekend and a day of because of easter so that is why I didn't express my gratitude till now.
I am on my way again, thank you for your time and effort.
Best regards,
Jasper
Flying is to throw yourself on the ground and miss
-
April 13th, 2004, 05:34 AM
#8
Hello hspc and THECPUWizard,
Thank you again for your time and effort to answer my question, I had weekend and a day of because of easter so that is why I didn't express my gratitude till now.
I am on my way again, thank you for your time and effort.
Best regards,
Jasper
you are always welcome
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|