471,572 Members | 904 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,572 software developers and data experts.

Where Clause with Multiple Criteria

42 32bit
Well! I have a list called List537 and I want to show two number of columns in it, after entering my value (number) in an unbound text box. I know how to get data source in the list with a single WHERE clause however, I want to use multiple criteria to get accurate results. I have a table called "Objectives" where two columns are exists i.e., Number and Question. I want to show them in a List537 wherein quantity of bounded columns are two with the size of 1";2". I have write the code below but facing "syntax error".

Expand|Select|Wrap|Line Numbers
  1. Me.List537.RowSource = "SELECT [Objectives].[Number],[Objectives].[Question]FROM " & _
  2.         " Objectives WHERE [SubjectID]= & Me.SubjectID And [ClassID] = & Me.ClassID" & _
  3.         " Order By Number"
Please anybody help. Thanks in advance.
1 Week Ago #1
2 3889
NeoPa
32,439 Expert Mod 16PB
Hi Aftab.

I wish I had a pound for every question where someone asks why 'X' doesn't work and they don't even include 'X' in the question - just an isolated selection of code that produces whatever 'X' is. We can never know what 'X' is because there are various references to variables of one type or another we have no information about.

So, I get your frustration when you are struggling with something, but please at least try to get the basics of the question down.

In this case it's clear that the last line (ORDER BY) can't work as you've used a reserved word (Number) without qualifying it in any way so it has no way of knowing you're trying to reference a Field in your Table, so obviously that will certainly fail. There may be further problems we could help with if/when you post the actual value you're trying to assign to Me.List537.RowSource, but they'll have to wait till we have such information.
1 Week Ago #2
Aftab Ahmad
42 32bit
OMG! Thanks NeoPa. I completely understood. Now, its working fine. Thanks again
1 Week Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by BerkshireGuy | last post: by
2 posts views Thread by dskillingstad | last post: by
2 posts views Thread by Jim.Mueksch | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.