troubleshooting Question

Insert SQL data into Access

Avatar of IBMJunkman
IBMJunkmanFlag for United States of America asked on
Microsoft Access
1 Comment1 Solution362 ViewsLast Modified:
Error messageI 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+Datepart(Month,DateWorked) AS [RptMonth]
from Hours
where DatePart(Year,DateWorked)*100+Datepart(Month,DateWorked)=201202
group by EmployeeID, DatePart(Year,DateWorked)*100+Datepart(Month,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?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros