I would like a Progress Bar on my form which basically mimics the progress bar in the status bar. I have a form which is importing a Text file using a specification. I'm using the progress bar ActiveX Object from MSCOMCTL.OCX
Since I am using TransferText, how can I set the progress bar to
a) advance properly
b) recognize what the max is
Code below WITH NO PROGRESS BAR... JUST SOME TEXT:
Private Sub cmdImport_Click()
Dim strTable As String
Dim strFileName As String
Dim intLen As Integer
Dim strFile As String
Dim dtFile As Date
Dim rst As Recordset
Dim intCount As Integer
Dim strSQLDate As String
Dim strSQLInsert As String
If (IsNull(txtFileOpen.Value) Or txtFileOpen.Value = "") Then
MsgBox "You must have a File specified to Import.", vbCritical, "Error Importing File"
lblProgress.Caption = "Error - No File Specified"
txtFileOpen.SetFocus
Exit Sub
End If
strFileName = txtFileOpen.Value
If (IsNull(txtTable.Value) Or txtTable.Value = "") Then
MsgBox "You must have a Table Name to Import the File to.", vbCritical, "Error Importing File"
lblProgress.Caption = "Error - No Table Name"
txtTable.SetFocus
Exit Sub
End If
strTable = txtTable.Value
lblProgress.Visible = True
lblProgress.Caption = "Importing Dun and Bradstreet Data. Use Ctrl-Break to stop Import"
On Error Resume Next
DoCmd****nSQL "DROP TABLE " & strTable
DoCmd.TransferText acImportFixed, "DNB Import Specification", strTable, strFileName
lblProgress.Caption = "Import Process Completed."
End Sub