Syntax error in form

B

Blakey300

Hi

I am using Access 2007 to create a database for my karate school.

I have 3 tables as follows: Students, Training Sessions & Training
attendance.

I want it to work as follows

I open the sessions form to enter the date and location of the session, this
form has a subform where i can select the students that attended that session.

On my students main form I have a tab control which holds a sub datasheet to
list the students sessions that they have attended.

I have all of this working great however here comes the problem:-

When I click the header of the sub datasheet (so I can use the filters) I
get the following error

syntax error in query expression '[SELECT[Training Sessions
Query]],[Training Sessions],[Training Session ID], [Training Sessions
Query],[Training Date],[Training Sessions Query],[Dojo],[Training Sessions
Query], [Session Type],[Training Sessions Query],Training Attendance
ID],Trainin

It dosen't show the rest of the error message but i hope you get the geist.

If I click OK it does actually seem to work ok but it is very annoying and
as I wont be the one who ultimatly uses the DB I would like to get it
resolved.

This DB is in early development so if i need to restuctre it wont be a
problem.

Any help or advice would be greatly received & if you need more info just ask.


Many thanks in advance

Dave
 
J

Jack Cannon

Dave,

Try changing
[SELECT[Training Sessions Query]]...
to
SELECT [Training Sessions Query]...

I also noticed that your commas do not always have a space character
following them.
I don't really know if that is acceptable or not but I always ensure that a
space
character always follows a comma in a SQL statement.

Jack Cannon
 
B

Bob Quintal

Hi

I am using Access 2007 to create a database for my karate school.

I have 3 tables as follows: Students, Training Sessions &
Training attendance.

I want it to work as follows

I open the sessions form to enter the date and location of the
session, this form has a subform where i can select the students
that attended that session.

On my students main form I have a tab control which holds a sub
datasheet to list the students sessions that they have attended.

I have all of this working great however here comes the problem:-

When I click the header of the sub datasheet (so I can use the
filters) I get the following error

syntax error in query expression '[SELECT[Training Sessions
Query]],[Training Sessions],[Training Session ID], [Training
Sessions Query],[Training Date],[Training Sessions
Query],[Dojo],[Training Sessions Query], [Session Type],[Training
Sessions Query],Training Attendance ID],Trainin

It dosen't show the rest of the error message but i hope you get
the geist.

If I click OK it does actually seem to work ok but it is very
annoying and as I wont be the one who ultimatly uses the DB I
would like to get it resolved.

This DB is in early development so if i need to restuctre it wont
be a problem.

Any help or advice would be greatly received & if you need more
info just ask.


Many thanks in advance

Dave
There are a few syntax errors in the query, there are too many
brackets, too many commas too many spaces in field names and not
enough dots and not enough spaces between field names.

Please post the code that triggers the error message and the SQL
statement so that we can figure out what it needs to be.
 
L

Lisa Way

Bob Quintal said:
Hi

I am using Access 2007 to create a database for my karate school.

I have 3 tables as follows: Students, Training Sessions &
Training attendance.

I want it to work as follows

I open the sessions form to enter the date and location of the
session, this form has a subform where i can select the students
that attended that session.

On my students main form I have a tab control which holds a sub
datasheet to list the students sessions that they have attended.

I have all of this working great however here comes the problem:-

When I click the header of the sub datasheet (so I can use the
filters) I get the following error

syntax error in query expression '[SELECT[Training Sessions
Query]],[Training Sessions],[Training Session ID], [Training
Sessions Query],[Training Date],[Training Sessions
Query],[Dojo],[Training Sessions Query], [Session Type],[Training
Sessions Query],Training Attendance ID],Trainin

It dosen't show the rest of the error message but i hope you get
the geist.

If I click OK it does actually seem to work ok but it is very
annoying and as I wont be the one who ultimatly uses the DB I
would like to get it resolved.

This DB is in early development so if i need to restuctre it wont
be a problem.

Any help or advice would be greatly received & if you need more
info just ask.


Many thanks in advance

Dave
There are a few syntax errors in the query, there are too many
brackets, too many commas too many spaces in field names and not
enough dots and not enough spaces between field names.

Please post the code that triggers the error message and the SQL
statement so that we can figure out what it needs to be.
 
L

Lisa Way

I had the same problem. I was getting a similar syntax error when I used a
datasheet on a subform, but the datasheet worked properly when I used it as a
main form. I found that I could work around the problem by creating a
separate query and using it as the datasheet's record source instead of
building the query directly in the record source of the datasheet itself.

Bob Quintal said:
Hi

I am using Access 2007 to create a database for my karate school.

I have 3 tables as follows: Students, Training Sessions &
Training attendance.

I want it to work as follows

I open the sessions form to enter the date and location of the
session, this form has a subform where i can select the students
that attended that session.

On my students main form I have a tab control which holds a sub
datasheet to list the students sessions that they have attended.

I have all of this working great however here comes the problem:-

When I click the header of the sub datasheet (so I can use the
filters) I get the following error

syntax error in query expression '[SELECT[Training Sessions
Query]],[Training Sessions],[Training Session ID], [Training
Sessions Query],[Training Date],[Training Sessions
Query],[Dojo],[Training Sessions Query], [Session Type],[Training
Sessions Query],Training Attendance ID],Trainin

It dosen't show the rest of the error message but i hope you get
the geist.

If I click OK it does actually seem to work ok but it is very
annoying and as I wont be the one who ultimatly uses the DB I
would like to get it resolved.

This DB is in early development so if i need to restuctre it wont
be a problem.

Any help or advice would be greatly received & if you need more
info just ask.


Many thanks in advance

Dave
There are a few syntax errors in the query, there are too many
brackets, too many commas too many spaces in field names and not
enough dots and not enough spaces between field names.

Please post the code that triggers the error message and the SQL
statement so that we can figure out what it needs to be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top