G
GracieLou
Hello eveyone, I am using Access 2003 and SQL Server 2000.
I have much less hair right now. I keep pulling it out.
I am trying to append records to a table in an SQL db. the code is;
Dim strSQL As String
Dim strTableName As String
Dim iLoop As Long
Dim DbAny As DAO.Database
Set DbAny = CurrentDb()
For iLoop = 1 To 12 strTableName = "L" & Format(iLoop)
me.txt4 = strTableName
strSQL = "INSERT INTO dbo_GLYr1 ( BU, JrnlID, JrnlDt, Period, AcctNbr,
DeptID, CostComponent, ABMSAct, ProjID, Description, InvDt, VndrNbr, VndrNm,
VouchID, InvNbr, JrnlLnRef, Amt )" & _
"SELECT InFile.BU, InFile.JrnlID, InFile.JrnlDt, InFile.Period,
InFile.AcctNbr, InFile.DeptID, InFile.CostComponent, InFile.ABMSAct,
InFile.ProjID, InFile.Description, InFile.InvDt, InFile.VndrNbr,
InFile.VndrNm, InFile.VouchID, InFile.InvNbr, InFile.JrnlLnRef, InFile.Amt" &
_
"FROM InFile" & strTableName & "as InFile"
Next iLoop
The loop is because I have 12 monthly files to append.
I know it loops through because I have a text box on a form that shows the
value of strTableName. however, I am getting no data in the SQL table.
Any ideas?
Any help is appreciated.
Thanks.
I have much less hair right now. I keep pulling it out.
I am trying to append records to a table in an SQL db. the code is;
Dim strSQL As String
Dim strTableName As String
Dim iLoop As Long
Dim DbAny As DAO.Database
Set DbAny = CurrentDb()
For iLoop = 1 To 12 strTableName = "L" & Format(iLoop)
me.txt4 = strTableName
strSQL = "INSERT INTO dbo_GLYr1 ( BU, JrnlID, JrnlDt, Period, AcctNbr,
DeptID, CostComponent, ABMSAct, ProjID, Description, InvDt, VndrNbr, VndrNm,
VouchID, InvNbr, JrnlLnRef, Amt )" & _
"SELECT InFile.BU, InFile.JrnlID, InFile.JrnlDt, InFile.Period,
InFile.AcctNbr, InFile.DeptID, InFile.CostComponent, InFile.ABMSAct,
InFile.ProjID, InFile.Description, InFile.InvDt, InFile.VndrNbr,
InFile.VndrNm, InFile.VouchID, InFile.InvNbr, InFile.JrnlLnRef, InFile.Amt" &
_
"FROM InFile" & strTableName & "as InFile"
Next iLoop
The loop is because I have 12 monthly files to append.
I know it loops through because I have a text box on a form that shows the
value of strTableName. however, I am getting no data in the SQL table.
Any ideas?
Any help is appreciated.
Thanks.