Advertisement

06.16.2008 at 02:41AM PDT, ID: 23487526
[x]
Attachment Details

Compare a value under a field to values in an array in WHERE clause

Asked by angie_angie in Access Coding/Macros, SQL Query Syntax, Internet Protocols

Tags: MS Access, VBA

Hi experts,

I'm writing a procedure using VBA in Access. What I want is to select the records from a table with such condition that the values in a specified field do not equal to any of the values in an array which I DO NOT know the size.

myArray = "123, 456, 789"      <------------------ In this case there are 3 values in this array, but in my case I  WOULD NOT know how many values are in.

The pseudo code is:

strSQL = "SELECT myTable.* FROM myTable WHERE [aField] <> any one of the values in myArray"

Can anyone help me how to write the correct SQL syntax?
Start Free Trial
[+][-]06.16.2008 at 02:45AM PDT, ID: 21791992

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, SQL Query Syntax, Internet Protocols
Tags: MS Access, VBA
Sign Up Now!
Solution Provided By: TimCottee
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.16.2008 at 09:43AM PDT, ID: 21795302

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.16.2008 at 08:22PM PDT, ID: 21799360

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 12:37AM PDT, ID: 21800591

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628