Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / April 2005

Tip: Looking for answers? Try searching our database.

SQL Error message

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony - 05 Apr 2005 01:31 GMT
I am receiving the following error:

Syntax error in query expression
reports_in_progress_current_xl[GLOBALDCCDATA].[GLOBAL_DCC_CODE]

when I am executing the following code:

For Each varItem In lst.ItemsSelected
   'All information is present; write a record to the link table
   lngID = lst.Column(0, varItem)
   servID = Forms![ServiceOrderRegister]![ServiceOrderNumber]
   MsgBox servID
   strSQL = "INSERT INTO TblOrderSubSysLnk (ServiceNumLnk,SubsystemLnk)" _
       & "SELECT [Service Order Register].ServiceOrderNumber, SubSystemID
FROM [Service Order Register], Subsystems WHERE [Service Order
Register].ServiceOrderNumber = " & servID & " AND SubSystemID = " & lngID &
";"
   DoCmd.RunSQL strSQL
Next varItem

But the query itself is executed properly. What is wrong, how I can fix it
to stop this error from appearing.

Thanks for help.
Sylvain Lafontaine - 06 Apr 2005 04:51 GMT
Try removing the ";" at the end and print each strSQL to make sure that
everything is OK.  Learn to use the Profiler on the SQL-Server and you will
probably see what's happening.

If not, then try to add the prefix:  dbo.  to the names of your tables in
your query statement.  It is possible that the DoCmd.RunSQL may add another
prefix.

Finally, replace this call to the DoCmd.RunSQL by ADO objects.  This command
is very, very limited in its features and don't give you the possibility of
using queries with parameters.

S. L.

>I am receiving the following error:
>
[quoted text clipped - 21 lines]
>
> Thanks for help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.