472,352 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Query result - how to filter by record set

Hi again :)

I have a form that user enters parameters into which then pops up another form with results filtered by the chosen parameter (field in table)

What I'd like to do is order the results from the query it fires by a record set of my choosing. I think I'm on the right track by trying to edit the sql that is passed to the query but it doesn't seem to work.....

Example from form that runs the query filtering by 'section/faculty' record:

If [Section/Faculty] <> "" Then
If Counter <> 0 Then
b = "AND (([Car Records].[Section/Faculty]) = [Forms]![Search Facility]![Section/Faculty])"
Else: b = "FROM [Car Records] WHERE ((([Car Records].[Section/Faculty]) = [Forms]![Search Facility]![Section/Faculty])"
End If
Counter = Counter + 1
Else: b = ""
End If


I thought I could add:

ORDER BY [Car Records].[FullName]

to the end of the sql query but i'm getting something wrong - it tends to delete the query and I get a missing operator message after it runs??

Am I close or on the wrong track please?
Mar 29 '07 #1
2 1420
I know why the query is getting deleted and maybe I'm totally in the wrong area.

This is where the actual query is updated each time:

Set qdf = dbs.CreateQueryDef("Results", "SELECT [Car Records].FullName, [Car Records].FName,[Car Records].SName, [Car Records].[Section/Faculty], [Car Records].[ID Number], [Car Records].[Vehicle Make], [Car Records].[Vehicle Model], [Car Records].[Vehicle Colour],[Car Records].[Licence Plate Number], [Car Records].[Notes], [Car Records].[Parking Record], [Car Records].[Application Received]" & a & b & c & d & e & h & f & g "ORDER BY [Car Records].[FullName]")

Maybe I am meant to order the results at this point (as shown) but my syntax is wrong isn't it?
Mar 29 '07 #2
Rabbit
12,516 Expert Mod 8TB
Well, at first glance and without more information, it looks to me you are missing spaces at the beginning of your string concatenations.

"Bob" & "Bill" = "BobBill"
Not "Bob Bill"
Mar 29 '07 #3

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

Similar topics

20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
1
by: shilsum | last post by:
I would like to seek your expert opinions on the following problem of mine: I have a table to store employees Here is the partial structure of...
2
by: Dom | last post by:
I need to run a query based on a query in Access. The second query has a number of conditions which all work well, but there is one more contition...
1
by: Aftershock | last post by:
I have looked on the groups but can't seem to find an answer. I have a parameter query that uses a form for its input. This form then opens up a...
5
by: Rated R1 | last post by:
I wrote this before in the NGs, so I am going to paste the responses that I got and see if someone can please help me. Email me and we can set...
5
by: Tim::.. | last post by:
Hi can someone please tell me how I change this directory service query so that it searches through each record in the active directory and returns...
0
by: JC Voon | last post by:
Hi All: I'm new in Threading and Web Services, can someone please verify my code, i'm not sure whether this is the correct way, althought it is...
5
by: Wired Hosting News | last post by:
I tried to be breif and give a scenario so as not to be overlooked because it was soooo long. Let me give you real world. I am a manufacturer of...
1
by: starke1120 | last post by:
Is there a way to open a form based on query type.. Example.. If a certain query result is 1 then open the form to this result.. If the query...
4
by: Simon | last post by:
Dear reader, The syntax for Docmd.OpenReport is: OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs) Example ...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.