If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Progress Bar and Transfertext VBA

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Dec 2003
Location: Greenwood, IN
Posts: 40
Angry Progress Bar and Transfertext VBA

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.RunSQL "DROP TABLE " & strTable
DoCmd.TransferText acImportFixed, "DNB Import Specification", strTable, strFileName

lblProgress.Caption = "Import Process Completed."
End Sub
__________________
Doug
Reply With Quote
  #2 (permalink)  
Old
Stuck on my opinions...
 
Join Date: Nov 2003
Posts: 1,487
If you previously know the size of what you are importing then perhaps through a OnTimer event you can read the quantity received and advance your progress bar this way. Problem may be though that the TransferText function might not release to the timer.
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Dec 2003
Location: Greenwood, IN
Posts: 40
It must be possible...

It must be possible... since the current status bar has a progress bar which works properly. I believe I can get the number of records in the text file using a windows call - but I've no idea how to calculate the time it will take to import the file, or how to advance it properly.
__________________
Doug
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Jul 2003
Location: Portugal
Posts: 111
Re: Progress Bar and Transfertext VBA

I found this sometime ago...

It's only a progress bar that works.

All you need is to put your code in the middle of the execution...

I don't know if this helps or not, but it's a simple and little prog.

Ruas
Attached Files
File Type: zip progressbar.zip (5.8 KB, 533 views)
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: Jul 2003
Location: Portugal
Posts: 111
Progress Bar

See if this can help you...
Attached Files
File Type: zip progressbar.zip (1.7 KB, 457 views)
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Dec 2003
Location: Greenwood, IN
Posts: 40
Invalid archive error

Could you email it to me? doug @ coders4hire.com
__________________
Doug
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
Join Date: Jul 2003
Location: Portugal
Posts: 111
I'm sorry... I see just now there are two mess from me.

The first time I had an error report sending the mess and the same in the second try... And they are here!!!

I'll send you just now

Ruas
Reply With Quote
  #8 (permalink)  
Old
Registered User
 
Join Date: Dec 2003
Location: Greenwood, IN
Posts: 40
That's interesting... they made their own. I still have the same problem though... don't know how to 'progress' it. Thanks, though!!!! This may be the way to go rather than relying on ActiveX components!
__________________
Doug
Reply With Quote
  #9 (permalink)  
Old
Registered User
 
Join Date: Jul 2003
Location: Portugal
Posts: 111
Let me suggest the following:

create a counter

Dim x
For x = 1 to 500
[create a field form named, by ex., n]
Me.n = x
Next

and see both working.

Try to put the code in the middle of the other...

Yes, that's nice because there is no need of add-ins or activeX
Reply With Quote
  #10 (permalink)  
Old
Registered User
 
Join Date: Aug 2012
Location: Heredia, Costa Rica
Posts: 4
jmruas the attached DB is not opening in WinZip. can you re-attach? Thanks.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On