Option Explicit Dim sCC As String Dim sFY As String Dim exitScript As Boolean Sub Main Call mainMenu() If Not exitScript Then Call performImport1() Call performImport2() Call performImport3() Call performImport4() Call performImport5() Call performImport6() Call performImport7() End If End Sub Function mainMenu() Dim dlg As dlgImport Dim button As Integer Dim exitMenu As Boolean exitMenu = FALSE Do button = Dialog(dlg) If button = 0 Then exitScript = True 'cancel button selected exitMenu = True Else 'get the variables sCC = dlg.txtCC sFY = dlg.txtFY 'check to make sure the variables have been entered If sCC = "" Or SFY = "" Then If sCC = "" Then MsgBox "Enter Cost Centre" End If If sFY = "" Then MsgBox "Enter Financial Year" End If Else 'no errors exitMenu = TRUE End If End If Loop Until exitMenu End Function Function performImport1() Dim dbName As String dbName = "Invoices.IMD" Client.ImportODBCFile **REDACTED ORACLE SERVER INFO**, select * from **REDACTED ORACLE TABLE INFO** where PAYMENT_DATE between '01-apr-19' and '31-mar-20' and COST_CENTRE = '" & sCC & "' And FINANCIAL_YEAR = '" & sFY & "'" Client.OpenDatabase (dbName)