Hi Guys,
Just getting into vba and I have the following problem:
I have written the following code whose purpose is to look in a directory for specific text files and import them if found, if they aren't there I want a msgbox to appear telling the user which files are missing. This works fine with my code up to a point, however the code will stop while it awaits a response to the msgbox (clicking OK), then it will run the next import. Is there a way I can get it to continue with the next routine regardless of whether the user has clicked OK on the mesgbox if the first file (tatracker) is not present....any manna from above greatfully recieved
Here's my begginers code.
Function import_leads()
' Imports hotleads file from C:\leads_folder\hotleads and appends to hotleads_temp_tbl
On Error GoTo import_leads_Err
If strfisfile("c:\leads_folder\hotleads\TATracker.txt") Then
DoCmd.TransferText acImportDelim, "hotleads_spec", "hotleads_temp_tbl", "C:\leads_folder\hotleads\tatracker.txt", True, ""
Else
MsgBox "TA Tracker file not found!", vbExclamation
End If
If strfisfile("c:\leads_folder\hotleads\PBTracker.txt") Then
DoCmd.TransferText acImportDelim, "pbhotleads_spec", "pbhotleads_temp_tbl", "C:\leads_folder\hotleads\pbtracker.txt", True, ""
Else
MsgBox "PB Tracker file not found!", vbExclamation
End If
import_leads_Exit:
Exit Function
import_leads_Err:
MsgBox Error$
Resume import_leads_Exit
End Function
Cheers,
Tommy B
Just getting into vba and I have the following problem:
I have written the following code whose purpose is to look in a directory for specific text files and import them if found, if they aren't there I want a msgbox to appear telling the user which files are missing. This works fine with my code up to a point, however the code will stop while it awaits a response to the msgbox (clicking OK), then it will run the next import. Is there a way I can get it to continue with the next routine regardless of whether the user has clicked OK on the mesgbox if the first file (tatracker) is not present....any manna from above greatfully recieved
Here's my begginers code.
Function import_leads()
' Imports hotleads file from C:\leads_folder\hotleads and appends to hotleads_temp_tbl
On Error GoTo import_leads_Err
If strfisfile("c:\leads_folder\hotleads\TATracker.txt") Then
DoCmd.TransferText acImportDelim, "hotleads_spec", "hotleads_temp_tbl", "C:\leads_folder\hotleads\tatracker.txt", True, ""
Else
MsgBox "TA Tracker file not found!", vbExclamation
End If
If strfisfile("c:\leads_folder\hotleads\PBTracker.txt") Then
DoCmd.TransferText acImportDelim, "pbhotleads_spec", "pbhotleads_temp_tbl", "C:\leads_folder\hotleads\pbtracker.txt", True, ""
Else
MsgBox "PB Tracker file not found!", vbExclamation
End If
import_leads_Exit:
Exit Function
import_leads_Err:
MsgBox Error$
Resume import_leads_Exit
End Function
Cheers,
Tommy B