• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 145
  • Last Modified:

you are about to append 0 rows

i have a local work table and a linked sql server table, i am trying to insert from my local work table into the linked table but i am getting the above error, i even have a primary key in the linked table.

task0 = "INSERT INTO dbo_WorkTable ( ID, [Batch ID], [Pay Group], [Pay Group Description], [General Ledger Account], [General Ledger Cost Center], [General Ledger Department], [Work Center], [Pay Period Ending Date], Hours, Amount, Week, [Pay Type Code], [Pay Type Description], [File Number], Name, [HOURLY SALARY], [FULL TIME_PART TIME], ACTIVE_INACTIVE, [HOURLY RATE] )" _
& "SELECT WorkTable.ID, WorkTable.[L Batch ID], WorkTable.[Pay Group], WorkTable.[Pay Group Description], WorkTable.[General Ledger Account], WorkTable.[General Ledger Cost Center], WorkTable.[General Ledger Department], WorkTable.[Work Center], WorkTable.[Pay Period Ending Date], WorkTable.Hours, WorkTable.Amount, WorkTable.Week, WorkTable.[Pay Type Code], WorkTable.[Pay Type Description], WorkTable.[File Number], WorkTable.Name, WorkTable.[HOURLY SALARY], WorkTable.[FULL TIME_PART TIME], WorkTable.ACTIVE_INACTIVE, WorkTable.[HOURLY RATE]" _
& " FROM dbo_WorkTable, WorkTable; "

Open in new window


DoCmd.RunSQL (task0)


Capture34.PNG
please help as my insert statement looks fine.
0
Aravind Ranganathan
Asked:
Aravind Ranganathan
1 Solution
 
PatHartmanCommented:
It isn't an error.  It is a warning message.  If 100 records were selected it would say "You are about to append 100 row(s)"

However, you do have an error in your Select query.  You have included both the source and target tables and not specified a join.  Change the last line to:

& " FROM WorkTable; "

and see if that resolved the 0 records problem.

If you don't want to see the warning messages, the best solution is to use the .Execute method of DAO to run the action query rather than the Access method of DoCmd.OpenQuery
1
 
Pawan KumarDatabase ExpertCommented:
Is this a typo or did you missed some join condition with & " FROM dbo_WorkTable, WorkTable; "
Or do you want any where clause..Basically you are cross join there tables. What the requirement?

task0 = "INSERT INTO dbo_WorkTable ( ID, [Batch ID], [Pay Group], [Pay Group Description], [General Ledger Account]
, [General Ledger Cost Center], [General Ledger Department], [Work Center], [Pay Period Ending Date], Hours, Amount, Week
, [Pay Type Code], [Pay Type Description], [File Number], Name, [HOURLY SALARY], [FULL TIME_PART TIME], ACTIVE_INACTIVE
, [HOURLY RATE] )" _
& "SELECT WorkTable.ID, WorkTable.[L Batch ID], WorkTable.[Pay Group], WorkTable.[Pay Group Description], WorkTable.[General Ledger Account]
, WorkTable.[General Ledger Cost Center], WorkTable.[General Ledger Department], WorkTable.[Work Center], WorkTable.[Pay Period Ending Date], WorkTable.Hours, WorkTable.Amount, WorkTable.Week
, WorkTable.[Pay Type Code], WorkTable.[Pay Type Description], WorkTable.[File Number], WorkTable.Name, WorkTable.[HOURLY SALARY], WorkTable.[FULL TIME_PART TIME], WorkTable.ACTIVE_INACTIVE
, WorkTable.[HOURLY RATE]" _
& " FROM WorkTable; "

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now