Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include VB progress Form in my module

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
0
0
GB
I have the below module which works and compiles but can take a while to run. It currently ends with a message to say it has finished which is not good enough, I need a vb Form (and not Access form) progress bar to start and finish as shown in the code and increment from zero to 100 percent complete thus showing the progress of the code in a much more acceptable way.

Code:
[COLOR=#204A87]
  Sub myMain()
  Dim text As String
  Set agent1 = New agent
  Dim mydb As Database
  Dim rst As DAO.Recordset

Set mydb = CurrentDb()
Set rst = mydb.OpenRecordset("Table1")
    
[highlight #FCE94F]'START HERE TO SHOW PROGRESS OF PAGE LOADING ETC ETC ETC[/highlight]

  agent1.visible = False
  agent1.openpage "[URL unfurl="true"]http://my.ebay.co.uk/ws/eBayISAPI.dll?MyEbay&gbh=1"[/URL]

 If agent1.moveTo("Email or user ID") Then
    agent1.getElement("userid").Value = "123abc"
    agent1.getElement("pass").Value = "456def"
    agent1.getElement("SignInForm").submit
    agent1.waitForLoad
 End If
  
  agent1.text = agent1.explorer.Document.all(1).outerhtml
  agent1.position = 1

'  Do While Not agent1.moveTo("s225") 'v4lnk
'
'    If Not agent1.moveTo("s225") Then MsgBox "Not a valid results page. Please navigate to an ebay page with a list of results."
'
'    agent1.text = agent1.explorer.Document.all(1).outerhtml
'    agent1.position = 1
'  Loop
  
  agent1.visible = False
  
  Do While getEbayData
    rst.AddNew
    rst![Title] = theTitle
    rst![Link] = theLink
    rst![Price] = thePrice
    rst![shipping] = Trim(shipping)
    rst.Update
  Loop
  
[highlight #FCE94F]'100 PERCENT COMPLETE HERE AS ANY PAGES HAVE BEEN LOADED AND DATA RETRIEVED[/highlight]

  Set agent1 = Nothing
  Set rst = Nothing
  Set mydb = Nothing

MsgBox "Finished"
  
End Sub[/color]

I have created the vb Form named frmProgress with 3 labels named lblLabel1 and lblLabel2.and lblProgressCaption and I’m trying to get it to work with something like the following lines of code which I need help with including how to push the progress along?

Code:
[COLOR=#204A87]
    frmProgress.Show
    frmProgress.lblLabel2.visible = True
    frmProgress.lblProgress.Width = (??? / ???) * (frmContinue.lblLabel2.Width)
    frmProgress.lblProgressCaption.Caption = [highlight #FCE94F]'CAN THIS SHOW STAGES LIKE URL LOADING AND FIELD VALUES ETC ETC ETC?[/highlight]
    Unload frmProgress
[/color]

Can anyone help me with the correct code and how to implement it in my module?
 
Hi strongm

I searched the internet for those events hoping to fathom some idea of how to implement it in my code without any luck.

Would what you had in mind show progress for the ‘Do While getEbayData' Part of the code as well as the URL?

Can you provide me with an example of how you would add those events to my code to achieve what I need?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top