Dim mblnParsingRecords As Boolean Dim mblnAbortImport As Boolean Private Sub Command1_Click() Import End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If mblnParsingRecords Then ' we're parsing mblnAbortImport = True Cancel = 1 End If End Sub Sub Import() mblnParsingRecords = True Do While True DoEvents If mblnAbortImport Then mblnParsingRecords = False Unload Me Exit Sub End If Loop End SubCheck this code and tell me if I ommit something in my simulation - if import procedure is in other module/form, if module-level variables are with different scope, etc.
Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000) br>
VB (.NET) - what other language do you need in the whole Universe?...