Donald Whittemore
asked on
Insert SQL data into Access
I have an empty Access table. I need to select data from a SQL DB and insert into the Access table. I eventually will do this using VBA but for now I am just trying to get the major steps working.
The Access table is defined. Named TSHrs. Contains 3 fields (TSEmpID, TSHrs, TSDate)
I am doing a Pass-Through query
The ODBC connection is defined.
The query is:
Insert into TSHrs ([TSEmpID], [TSHrs], [TSDate])
Select EmployeeID as [EmpID]
,isnull(sum(HoursWorked),0 ) as [Hours]
,DatePart(Year,DateWorked) *100+Datep art(Month, DateWorked ) AS [RptMonth]
from Hours
where DatePart(Year,DateWorked)* 100+Datepa rt(Month,D ateWorked) =201202
group by EmployeeID, DatePart(Year,DateWorked)* 100+Datepa rt(Month,D ateWorked)
order by EmployeeID
When I run the query in Access I get the pictured error. It appears I am trying to reference TSHrs in the SQL DB the ODBC references. Have I approached this wrong?
The Access table is defined. Named TSHrs. Contains 3 fields (TSEmpID, TSHrs, TSDate)
I am doing a Pass-Through query
The ODBC connection is defined.
The query is:
Insert into TSHrs ([TSEmpID], [TSHrs], [TSDate])
Select EmployeeID as [EmpID]
,isnull(sum(HoursWorked),0
,DatePart(Year,DateWorked)
from Hours
where DatePart(Year,DateWorked)*
group by EmployeeID, DatePart(Year,DateWorked)*
order by EmployeeID
When I run the query in Access I get the pictured error. It appears I am trying to reference TSHrs in the SQL DB the ODBC references. Have I approached this wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.