|
-
Jun 12th, 2000, 06:38 PM
#1
Thread Starter
Fanatic Member
If you are setting an ADO control's recordsource in runtime, can you have multiple where conditions?
eg.
If a database has two tables:
Forms (containing Title, Author, UpdateCode) and
UpdateDetails (containing UpdateCode, Surname)
Could you have a statement
"Select.... WHERE Forms.UpdateCode = UpdateDetails.UpdateCode, AND (TITLE = 'Quality Form' OR Surname = 'Bloggs')"
Is this possible and if so, what is the syntax to set the recordset??????
-
Jun 12th, 2000, 07:07 PM
#2
Fanatic Member
Hi Gilly
Yes you can do that, but you will need a common field that is in both tables (like updatecode in your example). You then need to do a join to get the information back. use the following code to achieve this.
SELECT ... FROM Forms as frm INNER JOIN UpdateDetails as upd on(frm.updatecode=upd.updatecode) WHERE ..
In the select part you can select any fields from either table using their alias (frm for form and ups for update details) eg. Select frm.updatecode,upd.*.
And in the where statement you can have frm.TITLE = 'Quality Form' OR upd.Surname = 'Bloggs'
Hope this helps
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
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
|