Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Function MakeData() Dim StrSQL As String Dim db As Database 'Current database. Dim lng As Long 'Loop controller. Dim rs As DAO.Recordset 'Table to append to. Dim lng1 As Long 'Loop controller. Dim rs1 As DAO.Recordset 'Table to append from. Dim ACCOUNT As String Dim YEAR As String Dim USER As String Dim REPEAT As Integer Dim TYPEREC As String 'StrSQL = "Delete * from tblPrint where user =" & fOSUserName() & ";" 'DoCmd.SetWarnings False 'DoCmd.RunSQL StrSQL 'DoCmd.SetWarnings True Set db = DBEngine(0)(0) Set rs1 = db.OpenRecordset("select * from ppPidList2 ;") Set rs = db.OpenRecordset("tblPrint", dbOpenDynaset, dbAppendOnly) Do While Not rs1.EOF ACCOUNT = rs1!ACCOUNT YEAR = rs1!YEAR USER = rs1!USER REPEAT = rs1!REPEAT TYPEREC = rs1!TYPE Set rs = db.OpenRecordset("tblPrint", dbOpenDynaset, dbAppendOnly) With rs For lng = 1 To REPEAT .AddNew !ACCOUNT = ACCOUNT !YEAR = YEAR !USER = USER !TYPE = TYPEREC .Update Next End With rs.Close Loop Set rs = Nothing Set db = Nothing Set rs1 = Nothing Set db = Nothing End Function
Join the community of 500,000 technology professionals and ask your questions.