Solved

Click on query result header and get an error message

Posted on 2014-12-18
12
107 Views
Last Modified: 2015-01-08
I have a form which opens in datasheet view.  The record source is a query with two tables joined.  The SQL for the query is:

SELECT Activities.Day, Projects.[Project name], Projects.Client, Activities.Hours, Activities.Activity, Activities.Employee
FROM Projects INNER JOIN Activities ON Projects.[Project ID] = Activities.[Project ID]
WHERE (((Activities.Day) Is Not Null))
ORDER BY Activities.Day, Projects.[Project name];

Open in new window


When I just open the query and click on the little down arrow next to the field header named Project name I get an error:

"Syntax error (missing operator) in query expression 'Project name'.

????

--Steve
0
Comment
Question by:SteveL13
12 Comments
 
LVL 18

Expert Comment

by:SimonAdept
ID: 40506985
Check that you haven't got a double space anywhere between "project" and "name" in the project name field, or that the field name in the table doesn't have a double space between the words.
0
 

Author Comment

by:SteveL13
ID: 40507002
Nope,.  No double spaces anywhere.  What is strange is that if I make the query be a make table query and then open the table it created it works fine.
0
 
LVL 18

Expert Comment

by:SimonAdept
ID: 40507019
OK, in the form properties, check that there isn't a filter based on project name and that filteronload isn't set to true.
Also check that there isn't an event associated with on_click for the form that references project name.

If you change the form to use the table you just created instead of teh query, does the problem occur then? If so, it's definitely a problem with the form properties.
0
 

Author Comment

by:SteveL13
ID: 40507034
No filer in the form properties.  Filteronload = No.  

and

"If you change the form to use the table you just created instead of the query, does the problem occur then?" No it does not.
0
 
LVL 18

Expert Comment

by:SimonAdept
ID: 40507058
Hmm. are the objects that you join in your datasource query both tables?
"FROM Projects INNER JOIN Activities"
... or is one or both of them another query?

Does the form have a module (i.e. any event handler code) or embedded macros? If so, I'd examine them for references to [project name].

Other than that. I'd resort to suggesting the you revert to using your query as the datasource for the form, but do a 'compact and repair' on the database.
0
 

Author Comment

by:SteveL13
ID: 40507331
Both are tables.  Nothing in the form that would cause this that I can find.  No event handlers, or embedded macros.  

I think I'll just use the table that the maketable query creates and then dump the data from it when the form closes.

Is a real mystery.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 34

Expert Comment

by:PatHartman
ID: 40508202
Have you defined a caption in the table?   The caption is what is displayed in the header of forms in DS view.  But that might be conflicting with a label that is attached to the control.  I'm not sure which takes precedence these days.  I avoided captions for years due to all sorts of subtle and not so subtle problems and this may be a new one.

Using temp tables cause bloat so keep at this until you/we identify the problem.
0
 

Author Comment

by:SteveL13
ID: 40508248
Pat,

No captions in any tables.
0
 
LVL 18

Expert Comment

by:SimonAdept
ID: 40508325
If you use the same SQL statement in a simple select query (in the query designer) and then view the results as datasheet and try to filter or sort on the [project name] column, do you get the same problem?

If so, consider aliasing the column as ProjectName:[Project name] - it shouldn't make any difference, but I'm always a little suspicious anywhere that a reserved word is used in column names.

Final thought for the day. Is that column involved in a relationship? Is it the primary key for the Projects table, or is there a numeric autonumber PK on the table?
0
 
LVL 30

Expert Comment

by:hnasr
ID: 40508864
Why not upload a sample database demonstrating the issue?
0
 

Accepted Solution

by:
SteveL13 earned 0 total points
ID: 40529095
Thank you to all that replied to my post.  I have decided to use my make-table solution.
0
 

Author Closing Comment

by:SteveL13
ID: 40537495
Thank you to all that replied.  I have decided to use my own make-table solution.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now