Help with Append Query in VB

ds0203

Registered User.
Local time
Yesterday, 23:16
Joined
Feb 22, 2007
Messages
14
I have data in an excel spreadsheet that I'm importing to Access using the transferspreadsheet code. I'm importing the data into table "tempIn" and then it will go into my final table "tempIn2" (I only want to append the rows where the units field is not blank). I can get the data into temp1 but when I try to append that data to tempIn2 it isn't working . The code I have to do this is:

db.Execute "INSERT INTO tempIn2 ( Name, [Date], Activity, Units, ActivityID )" & _
"SELECT tempIn.Name, tempIn.Date, tempIn.Activity, tempIn.Units, tlkpTransType.TransTypeID" & _
"FROM tempIn INNER JOIN tlkpTransType ON tempIn.Activity = tlkpTransType.TransType" & _
"WHERE (((tempIn.Units)>0));"

I have tried using the where clause ">0" and "not null" and neither of them are working.

When I am in the database screen, I can run the append query that I used to create the above SQL and the data appends just fine, so I'm completely stumped here.

Can anyone help me please?
:confused:
Thanks in advance!
 
ds,

Add Spaces:

db.Execute "INSERT INTO tempIn2 ( Name, [Date], Activity, Units, ActivityID ) " & _
"SELECT tempIn.Name, tempIn.Date, tempIn.Activity, tempIn.Units, tlkpTransType.TransTypeID " & _
"FROM tempIn INNER JOIN tlkpTransType ON tempIn.Activity = tlkpTransType.TransType " & _
"WHERE (((tempIn.Units)>0)); "

It was reading --> TransTypeIDFrom

That messes the parser up

Wayne
 
Wayne,

Thank you so much!!! I have been trying to figure this out all day. I knew it had to be something I was missing with the coding, I just couldn't find it. You're awesome, thanks again :)
 

Users who are viewing this thread

Back
Top Bottom