473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Syntax error when sorting subform

122 100+
I'm trying to make a very simple order form. I have two tables - OrderHeader has information specific to the order itself, such as company name and order date. OrderDetail contains details such as item number, quantity and price, and links to OrderHeader on the OrderID field. Such a setup that has probably been done thousands of times since the history of the world began.

I created a form bound to OrderHeader and put in a SubForm based on OrderDetail, linking by OrderID. I haven't changed a single property since creating the form; I want to get the basic data model working and then I'll go back and customize how everything looks and works.

As it is now, if the user clicks in the subform to sort or filter anything, I get the following error:

Expand|Select|Wrap|Line Numbers
  1. Syntax error in query expression '[SELECT [OrderDetail].[OrderNumber], [OrderDetail].[LineID], [OrderDetail].[Item], [OrderDetail].[Qty], [OrderDetail].[Price] FROM OrderDetail; ].Order'.
It looks like the record source of the sub form is being mangled with a partial field name being added to the end of the query. I'm not sure how to fix that because I'm not sure what's causing it. Has anyone encountered this before or know what the problem might be?

This is in Access 2007.
Feb 19 '10 #1
5 4819
topher23
234 Expert 100+
Can't say I've seen that one before. Have you checked your recordsource to make sure the extra text isn't actually on there?
Feb 19 '10 #2
NeoPa
32,556 Expert Mod 16PB
What is the subform bound to?
Feb 21 '10 #3
gershwyn
122 100+
topher23 - I did check the recordsource, and I copied it into a new query to make sure there were no other errors. I tried clearing the field and retyping it, too, but the error is still happening.

NeoPa - The subform is bound to the OrderDetail table. The record source is just a simple select statement displaying the items for a given order.

It should be noted that if I hit 'OK' on the error message, then the filter menu appears and I can sort the data or apply filters as normal. It's just when you initially click that the error appears.
Feb 22 '10 #4
NeoPa
32,556 Expert Mod 16PB
@gershwyn
It can be one or the other but not both. Perhaps if you pasted exactly what is in the property value that would help. Please don't tidy up any spaces or anything. Just paste as is.
@gershwyn
I have to say, without being entirely certain in the circumstances, that this makes me feel the error message is due to something you have yet to tell us of.
Feb 23 '10 #5
I had the same issue... Not sure if you figured it out, but if you turn the Data Properties --> Filter Lookup to Never for the field you're trying to sort it seems to fix the syntax error.
Nov 5 '10 #6

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

Similar topics

8
by: Dalan | last post by:
Please help - just take a quick look at the function code below. It probably just needs some minor tweaking. The function module is based on an intermediate query to provide a group record...
8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
1
by: Dalan | last post by:
I can't seem to find a workaround of Query Syntax Error. Actually, the query performs just fine, except when the last record on a related subform is deleted, then it generates a Runtime Error 3075...
1
by: Dalan | last post by:
I'm experiencing a Query Syntax Error with an Access 97 Db. Actually, the query performs as expected when adding any new records or editing existing ones and even deleting records, EXCEPT when the...
4
by: Patrick Arkins | last post by:
I have a Main form (named FRM_Main in the Forms Window) with a Subform (named FRM_User_Search in the Forms window, form_User_Search on Forms_Main). FRM_User_Search has a combo-box (cboSort) the...
3
by: Geoff | last post by:
Dependent on the value entered in one field in my subform I would like to display a particular value in a neighbouring bound combo box, in the subform, called EventCode. I've got in a mess...
7
by: jodyblau | last post by:
I'm new at this stuff, so bare with me. I have a main form which displays a client record. The main form has 2 subforms. The first subform has a list of Cases. The Second subform is a list of...
8
by: p | last post by:
I'm trying to put a query into VBA code and its giving me difficulties. I would like to put the following query: SELECT tbl_Workload.Priority, tbl_Workload.Number AS Num, tbl_Workload.Name,...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.