I’m getting a run-time error 3075
I have checked all the parentheses and quotes, everything seems okay but still not running.
‘Now Check the database to see if there are existing records for the Month and year in question
txtSQL = "SELECT Count([Rec_ID]) AS CountID FROM [dbo_NBD_EMEA_NBD_Source_Download] Where [Ledger_Year] = " & CurYear & " AND [Ledger_Month] = " & CurMonth & " AND ([Region_Cd] = 'EMEA' OR [Region_Cd] = 'APAC' OR [Region_Cd] = 'INDA');" Set dbs = CurrentDb Set Rs = dbs.OpenRecordset(txtSQL, dbOpenSnapshot) NumRecs = Rs("CountID") Rs.Close If NumRecs > 0 Then Prompt1 = "WARNING... There are " & NumRecs & " Records already in the database for Year " & CurYear & " Month " & CurMonth & Chr(10) & " Do you want to ERASE the existing records and REPLACE them with the NEW RECORDS in your IMPORT FILE " & Chr(10) & Selected_File & "?" Response1 = MsgBox(Prompt1, Style2, "DELETE EXISTING RECORDS IN DATABASE?") If Response1 = vbOK Then 'Continue with Delete of existing Records and Import of new Prompt2 = "Confirm... Existing Records will be deleted and replaced with your new file" Response2 = MsgBox(Prompt2, Style2, "Confirm Deletions") If Response2 = vbOK Then 'Run Stored Procedure to delete the records Me.ProcessStatus.Caption = "Deleting existing records" Set db = DBEngine.Workspaces(0).OpenDatabase("", False, False, Connect_String) db.Execute "XPROC1_NBD_EMEA_Source_Download_Delete " & CurYear & " , " & CurMonth, dbSQLPassThrough Set db = Nothing Else If Response2 = vbCancel Then 'If no confirmation of delete then cancel Me.ProcessStatus.Caption = "Import Canceled" Exit Sub End If End If Else If Response1 = vbCancel Then ' Cancel import Me.ProcessStatus.Caption = "Import Canceled" Exit Sub End If End If End If