Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with CreateTable

Status
Not open for further replies.

Catrina

Programmer
Feb 11, 2000
70
US
I am new to using Access in Vb. I am trying to create a table to run a report from(I had several problems getting the data the way I needed,so I tried this). I am using DataEnvironment and Datareport. The report will run once, but if I try to run it a second time, I get the error: "Record Deleted". The SQL from the DataReport is:

SELECT SalaryA3Query.RegHrs, SalaryA3Query.OvtHrs, SalaryA3Query.DblHrs, SalaryA3Query.SickHrs, SalaryA3Query.VacHrs, SalaryA3Query.HolHrs, SalaryA3Query.CommErn, SalaryA3Query.Oth1Ern, SalaryA3Query.Meals, SalaryA3Query.NoPay, SalaryA3Query.Tips, SalaryA3Query.Oth2Ern, SalaryA3Query.MiscHrs, SalaryA3Query.AdjToNet, SalaryA3Query.DeleteRec, SalaryA3Query.PAYCDE, SalaryA3Query.SCHR, SalaryA3Query.EXCFL, SalaryA3Query.CYCLE, SalaryA3Query.PAYEMP INTO SalaryTable
FROM SalaryA3Query
ORDER BY SalaryA3Query.PAYEMP;

And the code from my app is (QUERY1 is drawing from the created SalaryTable):

sSQL$ = "DROP TABLE SalaryTable"
Access.Execute sSQL$ ''Deleting previous table
Call DtaReports.CreateSalaryTable

'I get the error above on the second time through

SQL$ = ""
SQL$ = "SELECT "
SQL$ = SQL$ & "RegHrsb,"
SQL$ = SQL$ & "OvtHrsb,"
SQL$ = SQL$ & "dblHrsb,"
SQL$ = SQL$ & "SickHrsb,"
SQL$ = SQL$ & "VacHrsb,"
SQL$ = SQL$ & "HolHrsb,"
SQL$ = SQL$ & "CommErnb,"
SQL$ = SQL$ & "Oth1Ernb,"
SQL$ = SQL$ & "Mealsb,"
SQL$ = SQL$ & "NoPayb,"
SQL$ = SQL$ & "Tipsb,"
SQL$ = SQL$ & "MiscHrsb,"
SQL$ = SQL$ & "Oth2Ernb,"
SQL$ = SQL$ & "AdjToNetb,"
SQL$ = SQL$ & "SCHRb,"
SQL$ = SQL$ & "Val(PAYEMP) as PAYEMP FROM Query1 "
SQL$ = SQL$ & "ORDER BY PAYEMP"

DtaReports.rscomSalary.Open SQL$
RptSalary.Orientation = rptOrientLandscape
RptSalary.PrintReport
DtaReports.rscomSalary.Close

What do I need to do to run the report multiple times? Thanks in advance

Catrina
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top