Link to home
Start Free TrialLog in
Avatar of psilli1
psilli1

asked on

Synchronising code and form

I am running this piece of code :-

Do Until Len(sFilename) = 0

  Progress.Text = Progress.Text & vbCrLf & "Extracting Text from " & sFilename
  Call Import_to_access(sFilename)

  Progress.Text = Progress.Text & vbCrLf & "Exporting to " & Left(sFilename, Len(sFilename) - 4) & ".dbf"
  Call Export_current(sFilename)

  sFilename = Dir()
Loop

But the Progress field is not updated until the whole thing has finished.  Is it possible to have a way of showing the progress as it goes?

Thanks
Avatar of VK
VK
Flag of Germany image

if Progress is a TextBox:

Progress.Multiline = true ?
Avatar of Guy Hengel [angelIII / a3]
Yes.

Do until ...
  ...
  DOEVENTS
  ...
Loop

Cheers

ASKER CERTIFIED SOLUTION
Avatar of deighton
deighton
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WalterM
WalterM

Try to issue a refresh statement like

   Progress.Refresh

immediately after changing the progress bar's properties.

Michel
If not you could try Progress.refresh or DoEvents
Hi
u should add Progress.Refresh after you set the text property.  This method forces the text box to redraw before the rest of the code continues to execue.

Cat