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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InnerHTML & Listview... Not loading "Fast" Enough...

Status
Not open for further replies.

sgkdnay

Technical User
Aug 4, 2008
21
I know I did decent job on coding (considering learning by the book & hard way), anyhoo... I can't, for the life of me, figure out why Listview isn't capturing all the data, I checked the web and it was loading fast like it was supposed to, but the Listview isn't inputting the data quick enuff before the web update its query.

Mind you that I don't have direct access to the database with the company, hence why I use innerHTML. Care to give me some insight what I'm doing wrong or could do to improve this coding?

On Error Resume Next
Dim NextRow As Long
Dim CountToSave As Long
Dim CountSets As Long
Dim x As Long
Dim endx As Long
Dim ReturnedText As String
Dim CurRow As Long
Dim sta As Variant 'test
Dim abc As Variant 'test
SArray(1) = "AL"
SArray(2) = "AK"
SArray(3) = "AZ"
SArray(4) = "AR"
SArray(5) = "CA"
'sarray continues down to 50 states

AArray(1) = "A"
AArray(2) = "B"
AArray(3) = "C"
AArray(4) = "D"
AArray(5) = "E"
'aarray continues down to (26 letters)

ColumnCount = 5
CountToSave = 0
LastSaveMark = 1
CList.ListItems.Clear
endx = CRM.Document.body.All.tags("td").length
RowCount = CountRows
NextRow = 0
CurColumn = 0
CurRow = 1
TriggerNewRow = True
tmrClock.Enabled = True 'timer
tmrclock_Timer 'timer
For Each sta In SArray 'test
For Each abc In AArray 'test
Text1.Text = abc 'checking if goes thru arrays (temp information to verify if it works)
Text2.Text = sta 'checking if goes thru arrays (temp information to verify if it works)
CRM.Document.getElementById("name").focus
CRM.Document.myform.Name.Value = abc 'input name
CRM.Document.getElementById("status").focus 'test
SendKeys "{s}" 'send s to dropmenu
CRM.Document.getElementById("state").focus
CRM.Document.myform.State.Value = sta 'input state abbrev
CRM.Document.getElementById("SearchIt").focus
CRM.Document.getElementById("SearchIt").Click 'pull new data
Do: DoEvents: Loop Until CRM.Busy = False
For x = 0 To endx
DoEvents
ReturnedText = ""
ReturnedText = Trim(ReturnAfterRemoval(CRM.Document.body.All.tags("td").Item(x).innerText)) 'remove data i dont want in listview
If ReturnedText = "No Leads Found" Then
If TriggerNewRow = True Then
NextRow = CList.ListItems.Count + 1
CList.ListItems.Add
CList.ListItems.Item(NextRow).Text = CurRow
TriggerNewRow = False
End If
Else
If Not ReturnedText = "" Then
'Sleep (5)
CurColumn = CurColumn + 1
If TriggerNewRow = True Then
NextRow = CList.ListItems.Count + 1
CList.ListItems.Add
CList.ListItems.Item(NextRow).Text = CurRow
TriggerNewRow = False
End If
If CurColumn >= ColumnCount Then
CList.ListItems.Item(NextRow).SubItems(CurColumn) = ReturnedText
CurRow = CurRow + 1
CurColumn = 0
TriggerNewRow = True
Else
CList.ListItems.Item(NextRow).SubItems(CurColumn) = ReturnedText
End If
End If
End If
Sleep (5)
Next x
Next abc
Next sta
tmrClock.Enabled = False
End Function
 
Further ado,

when i do a step by step "code watch" it pulled all the data just fine, but when it runs real-time, sometimes it pulls well until letter "k", then it messed up, other time another letter messed up, how could i get the "loop" to wait (not using sleep(x)) before resuming or the like?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top