Avatar of IBMJunkman
IBMJunkman
Flag for United States of America asked on

Insert SQL data into Access

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?
Microsoft Access

Avatar of undefined
Last Comment
peter57r

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
peter57r

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck