Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 31st, 2004, 04:42 AM
Registered User
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default multiple stLinkCriteria?

Hello all,

Iam a complete beginner, so please be gentle. Im trying to (if possible) create a form to be used as a "search" facility of another form.

All users list their favourite foods:
dave eggs chocolate
steve cheese chocolate
tony beef chocolate

And so in my search I have a combobox of eggs, chocolate, cheese, and beef.
Should eggs be selected I would like only dave to be shown on the next form. Though if chocolate is selected, then all three need o be shown.

So far I've got:
stLinkCriteria = "[food1]=" & "'" & Me![chooser] & "'" And "[food2]=" & "'" & Me![chooser] & "'"
but this doesnt work, and is probably not the most elegant way of doing this.

Any ideas?

Many thanks
Ed



 
Old January 31st, 2004, 02:15 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

use an IN() operator in your sql statement whenever you have a list of possible values to use:

IN('eggs','cheese','beef')

IN('eggs')

or for numeric values

In(1,2,3,4,5,6)

The sintax may differ as far as whether to use single quotes or double quotes depending on your back end: Access, Sql server, Oracle, DB2, Etc. I get confused...

Are you familiar with VBA or ADO?



Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
stLinkCriteria - Multiple Criteria andyv123 Access 1 September 8th, 2006 10:02 AM
stLinkCriteria and an error about .!) alie Beginning VB 6 0 February 11th, 2006 11:26 AM
Importing Multiple files in Multiple tables Versi Suomi Access 6 June 1st, 2005 08:47 AM
Multiple Joins in Multiple Table Search query pookster Access 4 September 23rd, 2004 03:04 PM
Updating multiple Rows from multiple fields in ASP vdm_nana SQL Server ASP 0 April 1st, 2004 04:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.