473,387 Members | 1,899 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.

error in recordsource after converting to sql server 2000

I have converted access 97 to access xp project and connect the table
from my sql server 2000. my problem is that when i run my report it
says "Invalid SQL Statement. Check the server filter on the form
recordsource"

now this is my recordsource in my report.

SELECT Students.IDNo, [LastName] & ", " & [FirstName] & " " &
[MiddleName] AS Name, Students.Address, Students.PlaceofBirth,
Students.DateofBirth, Students.[Parent/Guardian], Students.ElemSchool,
Students.ESAddress, Students.ESSchYear, Students.SecSchool,
Students.SSAddress, Students.SSSchYear, Program.ProgramTitle,
Program.ProgramDesc, IIf([ProgramTitle]="BEED","with concentration in
" & [Major],[Major]) AS MajorTemp, [Sem] & " Semester, " & [SchYr] AS
SchYrSem, Course.CourseCode, Course.CourseTitle,
SchYrSemCourseJoin.Final, Course.Unit, Students.IDNo,
SchYrSem.SchYrSemID, SchYrSemCourseJoin.Annotation
FROM (Program INNER JOIN Students ON Program.ProgramID =
Students.ProgramID) INNER JOIN ((Major INNER JOIN SchYrSem ON
Major.MajorID = SchYrSem.MajorID) INNER JOIN (Course INNER JOIN
SchYrSemCourseJoin ON Course.CourseID = SchYrSemCourseJoin.CourseID)
ON SchYrSem.SchYrSemID = SchYrSemCourseJoin.SchYrSemID) ON
Students.IDNo = SchYrSem.IDNo
WHERE ((([LastName] & ", " & [FirstName] & " " &
[MiddleName])=[Forms]![Transcript of Records Dialog]![txtName]));

i would be very glad if someone can help me on this matter.

thanks in advance
Jul 20 '05 #1
3 2935
jaYPee (hi******@yahoo.com) writes:
I have converted access 97 to access xp project and connect the table
from my sql server 2000. my problem is that when i run my report it
says "Invalid SQL Statement. Check the server filter on the form
recordsource"

now this is my recordsource in my report.

SELECT Students.IDNo, [LastName] & ", " & [FirstName] & " " &
[MiddleName] AS Name, Students.Address, Students.PlaceofBirth,
Students.DateofBirth, Students.[Parent/Guardian], Students.ElemSchool,
Students.ESAddress, Students.ESSchYear, Students.SecSchool,
Students.SSAddress, Students.SSSchYear, Program.ProgramTitle,
Program.ProgramDesc, IIf([ProgramTitle]="BEED","with concentration in
" & [Major],[Major]) AS MajorTemp, [Sem] & " Semester, " & [SchYr] AS
SchYrSem, Course.CourseCode, Course.CourseTitle,
SchYrSemCourseJoin.Final, Course.Unit, Students.IDNo,
SchYrSem.SchYrSemID, SchYrSemCourseJoin.Annotation
FROM (Program INNER JOIN Students ON Program.ProgramID =
Students.ProgramID) INNER JOIN ((Major INNER JOIN SchYrSem ON
Major.MajorID = SchYrSem.MajorID) INNER JOIN (Course INNER JOIN
SchYrSemCourseJoin ON Course.CourseID = SchYrSemCourseJoin.CourseID)
ON SchYrSem.SchYrSemID = SchYrSemCourseJoin.SchYrSemID) ON
Students.IDNo = SchYrSem.IDNo
WHERE ((([LastName] & ", " & [FirstName] & " " &
[MiddleName])=[Forms]![Transcript of Records Dialog]![txtName]));

i would be very glad if someone can help me on this matter.


I don't know about Access, so I don't know whether this code runs in
Access or on SQL Server. But in case of the latter, be aware of that
although both runs SQL, there are vast differences in he SQL dialects.
For instance, in the above you use IIf() which is Access-specific. In
SQL Server you use the CASE epxression instead.

However, the error message does not come from SQL Server, so maybe you
are trying to execute in Access after all, but the tables are in SQL
Server.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
jaYPee wrote:
I have converted access 97 to access xp project and connect the table
from my sql server 2000. my problem is that when i run my report it
says "Invalid SQL Statement. Check the server filter on the form
recordsource"

now this is my recordsource in my report.

SELECT Students.IDNo, [LastName] & ", " & [FirstName] & " " &
[MiddleName] AS Name, Students.Address, Students.PlaceofBirth,
Students.DateofBirth, Students.[Parent/Guardian], Students.ElemSchool,
Students.ESAddress, Students.ESSchYear, Students.SecSchool,
Students.SSAddress, Students.SSSchYear, Program.ProgramTitle,
Program.ProgramDesc, IIf([ProgramTitle]="BEED","with concentration in
" & [Major],[Major]) AS MajorTemp, [Sem] & " Semester, " & [SchYr] AS
SchYrSem, Course.CourseCode, Course.CourseTitle,
SchYrSemCourseJoin.Final, Course.Unit, Students.IDNo,
SchYrSem.SchYrSemID, SchYrSemCourseJoin.Annotation
FROM (Program INNER JOIN Students ON Program.ProgramID =
Students.ProgramID) INNER JOIN ((Major INNER JOIN SchYrSem ON
Major.MajorID = SchYrSem.MajorID) INNER JOIN (Course INNER JOIN
SchYrSemCourseJoin ON Course.CourseID = SchYrSemCourseJoin.CourseID)
ON SchYrSem.SchYrSemID = SchYrSemCourseJoin.SchYrSemID) ON
Students.IDNo = SchYrSem.IDNo
WHERE ((([LastName] & ", " & [FirstName] & " " &
[MiddleName])=[Forms]![Transcript of Records Dialog]![txtName]));

i would be very glad if someone can help me on this matter.

thanks in advance


I assume you went from an Access app to an Access ADP? As Erland says,
SQL Server doesn't support IIf() and the dialect is different so:

Select blah, blahblah,
Case [ProgramTitle]
When 'BEED' then 'with concentration in ' + [Major]
else [Major])
end AS MajorTemp, blahblahblah from...

or
Select blah, blahblah,
MajorTemp = Case [ProgramTitle]
When 'BEED' then 'with concentration in ' + [Major]
else [Major])
end , blahblahblah from...

Note the use of single quotes, SQL Server uses double quotes for column
names like Access uses [] (although it uses [] as well). I haven't used
ADPs myself so I don't know what Access will do with your forms!
parameter, whether it will evaluate it before sending the SQL to the
server or send it as is, if the latter it will fail as the server will
not know what's on your forms. Perhaps someone more experienced in ADPs
can throw some light on the subject.

Oh, also note that string concatenation is acheived using the + operator
and not the & and that it works more like Access when using + instead of
& as well in that concatenating a string to a null will give a null
result. Also note on that point that implicit conversion does not take
place on the server either so if you want to concatenate a string to an
integer you will have to convert it explicitly, e.g.

[MyString] + Cast([MyInt] As Varchar) or
[MyString] + Convert(varchar,[MyInt])

JIC [MyString] was null, you'd use:
ISNULL([MyString],'') + Cast([MyInt] As Varchar)

ISNULL() on SQL Server is the equivalent of Nz() in Access.
--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Jul 20 '05 #3
Thanks for the reply. i have fix some errors except on how can i pass
my criteria "Forms]![Transcript of Records Dialog]![txtName]" to sql
server 2000.

i would be very glad if someone can teach me on how to pass this
parameter.
On Tue, 27 Apr 2004 00:16:44 +0100, Trevor Best <nospam@localhost>
wrote:
jaYPee wrote:
I have converted access 97 to access xp project and connect the table
from my sql server 2000. my problem is that when i run my report it
says "Invalid SQL Statement. Check the server filter on the form
recordsource"

now this is my recordsource in my report.

SELECT Students.IDNo, [LastName] & ", " & [FirstName] & " " &
[MiddleName] AS Name, Students.Address, Students.PlaceofBirth,
Students.DateofBirth, Students.[Parent/Guardian], Students.ElemSchool,
Students.ESAddress, Students.ESSchYear, Students.SecSchool,
Students.SSAddress, Students.SSSchYear, Program.ProgramTitle,
Program.ProgramDesc, IIf([ProgramTitle]="BEED","with concentration in
" & [Major],[Major]) AS MajorTemp, [Sem] & " Semester, " & [SchYr] AS
SchYrSem, Course.CourseCode, Course.CourseTitle,
SchYrSemCourseJoin.Final, Course.Unit, Students.IDNo,
SchYrSem.SchYrSemID, SchYrSemCourseJoin.Annotation
FROM (Program INNER JOIN Students ON Program.ProgramID =
Students.ProgramID) INNER JOIN ((Major INNER JOIN SchYrSem ON
Major.MajorID = SchYrSem.MajorID) INNER JOIN (Course INNER JOIN
SchYrSemCourseJoin ON Course.CourseID = SchYrSemCourseJoin.CourseID)
ON SchYrSem.SchYrSemID = SchYrSemCourseJoin.SchYrSemID) ON
Students.IDNo = SchYrSem.IDNo
WHERE ((([LastName] & ", " & [FirstName] & " " &
[MiddleName])=[Forms]![Transcript of Records Dialog]![txtName]));

i would be very glad if someone can help me on this matter.

thanks in advance


I assume you went from an Access app to an Access ADP? As Erland says,
SQL Server doesn't support IIf() and the dialect is different so:

Select blah, blahblah,
Case [ProgramTitle]
When 'BEED' then 'with concentration in ' + [Major]
else [Major])
end AS MajorTemp, blahblahblah from...

or
Select blah, blahblah,
MajorTemp = Case [ProgramTitle]
When 'BEED' then 'with concentration in ' + [Major]
else [Major])
end , blahblahblah from...

Note the use of single quotes, SQL Server uses double quotes for column
names like Access uses [] (although it uses [] as well). I haven't used
ADPs myself so I don't know what Access will do with your forms!
parameter, whether it will evaluate it before sending the SQL to the
server or send it as is, if the latter it will fail as the server will
not know what's on your forms. Perhaps someone more experienced in ADPs
can throw some light on the subject.

Oh, also note that string concatenation is acheived using the + operator
and not the & and that it works more like Access when using + instead of
& as well in that concatenating a string to a null will give a null
result. Also note on that point that implicit conversion does not take
place on the server either so if you want to concatenate a string to an
integer you will have to convert it explicitly, e.g.

[MyString] + Cast([MyInt] As Varchar) or
[MyString] + Convert(varchar,[MyInt])

JIC [MyString] was null, you'd use:
ISNULL([MyString],'') + Cast([MyInt] As Varchar)

ISNULL() on SQL Server is the equivalent of Nz() in Access.


Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jaYPee | last post by:
I have converted access 97 to access xp project and connect the table from my sql server 2000. my problem is that when i run my report it says "Invalid SQL Statement. Check the server filter on the...
0
by: Jerry | last post by:
Using MS SQL-server 2000, with Access 2000 adp as frontend Hi all, I'm kinda stuck with the code below. What I'm trying to accomplish here is to extract certain records from a table, based on...
0
by: M. Farrenkopf | last post by:
I am in the process of converting a Jet database to ADP using SQL Server 2000. Most of this conversation has been smooth, but now I'm running across a problem that has me stumped. Access 2000 SP3...
1
by: CSDunn | last post by:
Hello, In an Access 2003 Project that uses a SQL Server 2000 database as its data source, I am attempting to set the RecordSource property of a sub report called 'RptTeacherHistory2' that appears...
1
by: Sunil Korah | last post by:
I am having some trouble with opening recordsets. I have used code more or less straight from the access help. But still I am getting some errors. I am unable to work out what exactly I am doing...
2
by: Mark Flippin | last post by:
I'm converting the backend of an Access 2000 database to SQL Server 2000. The existing database has user and group security through a specific workgroup file. Under the "user and group...
6
by: olaf | last post by:
Hi! When using the "me." keyword (for ex. me.FilterOn = True), I sometimes (not always) get the error message: "The expression yuo entered refers to an object that is closed or doesn't exist."...
2
by: trialproduct2004 | last post by:
Hi all, I want to catch error in stored procedure and return error message. I want to catch error 'Syntax error converting the varchar value 'a' to a column of data type int.' Means error...
10
by: gary0gilbert | last post by:
An unusual spin to this recurring disk or network error in a Terminal Server environment. Access 2000, Terminal Server 2000, file server is windows 2000. All users have a separate copy of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.