Hi All,
I’m having problem in updating the Table using VBA. I have imported the data from Excel and immediately updating the Reporting Month in imported table. This update statement sometime works and sometime does not. Quite weird :banghead:… Below is the VBA code I’m using in MS Access 2003. OS – Windows XP.
objAccess.DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
tsWeeklyMIByProd, Input_Dir & "\" & InputFileName2, True, File1Wks1 & "!"
strUpdateSQL = "UPDATE " & tsWeeklyMIByProd & " SET ReportingMonth = '" & txtReportingMonth & "' "
gsPnPDatabase.Execute (strUpdateSQL)
objAccess.DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
tsOptionsByProd, Input_Dir & "\" & InputFileName1, True, File1Wks1 & "!"
strUpdateSQL = "UPDATE " & tsOptionsByProd & " SET ReportingMonth = '" & txtReportingMonth & "' "
gsPnPDatabase.Execute (strUpdateSQL)
I'm updating mutiple update statments and tracing the number of records updated using below code.
lngRowsUpdatedTbl1 = lngRowsUpdatedTbl1 + gsPnPDatabase.RecordsAffected
but when I display on the screen number of records affected it shows 0 records affected. Any idea what's wrong over here
Any idea what are these problems and how to resolved this?
Thanks
Ria
I’m having problem in updating the Table using VBA. I have imported the data from Excel and immediately updating the Reporting Month in imported table. This update statement sometime works and sometime does not. Quite weird :banghead:… Below is the VBA code I’m using in MS Access 2003. OS – Windows XP.
objAccess.DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
tsWeeklyMIByProd, Input_Dir & "\" & InputFileName2, True, File1Wks1 & "!"
strUpdateSQL = "UPDATE " & tsWeeklyMIByProd & " SET ReportingMonth = '" & txtReportingMonth & "' "
gsPnPDatabase.Execute (strUpdateSQL)
objAccess.DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
tsOptionsByProd, Input_Dir & "\" & InputFileName1, True, File1Wks1 & "!"
strUpdateSQL = "UPDATE " & tsOptionsByProd & " SET ReportingMonth = '" & txtReportingMonth & "' "
gsPnPDatabase.Execute (strUpdateSQL)
I'm updating mutiple update statments and tracing the number of records updated using below code.
lngRowsUpdatedTbl1 = lngRowsUpdatedTbl1 + gsPnPDatabase.RecordsAffected
but when I display on the screen number of records affected it shows 0 records affected. Any idea what's wrong over here
Any idea what are these problems and how to resolved this?
Thanks
Ria