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 / July 2008

Tip: Looking for answers? Try searching our database.

Select into Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cameron - 31 Jul 2008 21:54 GMT
I am working on writing a function that would filter data and create a table
from it. But I keep getting an error saying that there has to be a table
defined.

I checked the SQL string while running and the varibles are defined so i am
kind of baffled why it gives me this error.

The code in my function is as follows:

Function BuildNew()     '   Filters EmpSessions table and builds new session
tables from the filtered data

   Dim db As Database
   Dim rst As Recordset
   Dim sSql As String
       
   
   Set db = CurrentDb()
   Set rst = db.OpenRecordset("SessionType")
   rst.MoveFirst
   Do Until rst.EOF    ' look through records
       sSql = "SELECT EmpSessions.EmpID, EmpSessions.CourseID,
EmpSessions.SessionID, EmpSessions.CertificationDate, EmpSessions.ExpiryDate,
EmpSessions.Followup INTO " & rst("CatTable")
       sSql = sSql & "FROM (TrainingTypeLookup INNER JOIN CoursesMaster ON
TrainingTypeLookup.TrainingType = CoursesMaster.TrainingType) INNER JOIN
EmpSessions ON CoursesMaster.CourseID = EmpSessions.CourseID"
       sSql = sSql & "WHERE (((TrainingTypeLookup.TrainingType)= '" &
rst("Catagory") & " '));"
       'db.Execute sSql ' builds new tables
       DoCmd.RunSQL sSql
   Loop
    rst.Close
    Set rst = Nothing
   
End Function
Sylvain Lafontaine - 31 Jul 2008 22:37 GMT
Probably a missing space before the FROM and the WHERE keywords.  Display
the whole string for debugging purpose.  Also, this newsgroup is about ADP
and SQL-Server and has nothing to do with JET/Access and its particular
syntax for queries.

Signature

Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)

>I am working on writing a function that would filter data and create a
>table
[quoted text clipped - 35 lines]
>
> End Function
 
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.