My db needs to load xls files that are dropped into a folder by Peoplesoft. The first row contains record count information and the second row contains field headers.
My code is finding the correct file to load, processing the load into a tempory table, then moving and adding two new fields,one today's date, another a calculated filed based on another field to ease other queries.
Problem is that the code only pulls in range A3:V255 on both files. Below is the code used to pull in the larger file that has data in columns A:AZ
Everyday the code pulls in only 253 records when the average has been almost 400 records I have no issues copying and pasteing the data into the tables without loosing any data so I would assume that rules out data issues. I also have doubts over that since everyday, with new data, yet the file cuts off at the same record count for the 8 strait files. It did work the one day we only had 109 records.
My code is finding the correct file to load, processing the load into a tempory table, then moving and adding two new fields,one today's date, another a calculated filed based on another field to ease other queries.
Problem is that the code only pulls in range A3:V255 on both files. Below is the code used to pull in the larger file that has data in columns A:AZ
Everyday the code pulls in only 253 records when the average has been almost 400 records I have no issues copying and pasteing the data into the tables without loosing any data so I would assume that rules out data issues. I also have doubts over that since everyday, with new data, yet the file cuts off at the same record count for the 8 strait files. It did work the one day we only had 109 records.
Code:
Private Sub LoadME(strfilename As String) 'set query names to variables Dim strq1 As String Dim strq2 As String Dim strq3 As String Dim strq4 As String Dim strfilepath As String Dim strtable As String Dim strSQL As String ' location of files to be loaded strfilepath = "T:\MasterDatabase\QRY_MASTER_PeopleSoft\POManagementReports\" ' query used to remove yesterdays records from working file strq1 = "qry_Delete_Yesterdays_MatchExceptions" ' query used to move imported records to working file strq2 = "qry_Add_Todays_MatchException_Data" ' query used to find new buyers and add to the buyers table list strq3 = "qry_New_MatchException_Buyer" ' will be used to capture totals for history and reporting 'strq4 = TBD qry ' table used to import the records to before moving to working file strtable = "tbl_Match_Exception_RawLoad" ' SQL code to clear out the records from yesterday if they still exist strSQL = "Delete * from tbl_Match_Exception_RawLoad" ' clear out the loading table CurrentDb.Execute strSQL 'load new file into raw table DoCmd.TransferSpreadsheet acImport, 8, strtable, strfilepath & strfilename, False, "A3:AZ2000" ' remove yesterday's working file records DoCmd.OpenQuery strq1 ' move records from raw table to working table DoCmd.OpenQuery strq2 ' check for new buyers and insert new ones into buyers table DoCmd.OpenQuery strq3 ' capurture totals for history 'DoCmd.OpenQuery strq4 ' SQL code to clear out the records from that were just loaded into the working table strSQL = "Delete * from tbl_Match_Exception_RawLoad" End Sub
Comment