2 very quick replies, thanks.
OK, the main table being looped through is a linked table, stored in a remote SQL server. I can change nothing, just read it. My looping process examines a field for text. [1] There may or may not be text in this field. I am trying to note the date of the first occurance of text.
The first time the loop says "yes, there is text" I have it copy the date from another field. I tried storing this date in a global variable, but couldn't access it from a report. A link I googled said globals can only be accessed from VBA not reports. So I have a table I use to store settings, I call it tblIni. I made a field in there and store this date.
The report is bound to the table that stores the results of the 30,000 loopings. The report heading is to include the date of the first instance so I want to retrieve it from this second table.
This is my loop and how I retrieve the date. The inner If loop just makes sure it's only done once.
CODE
'Loop through all records in rstIn. Look for text in the tag field and split it into
'a storage table.
Do Until rstIn.EOF
'Show a counter to the user on the button
'The loop is to reduce flickering when redrawing the caption.
If intRefreshRate = 100 Then
lblPercentCounter.Caption = Int((i / intNumberOfRecords) * 100) & " %"
Me.Repaint
intRefreshRate = 0
End If
intRefreshRate = intRefreshRate + 1
'If no text in the tag field then loop around.
If IsNull(rstIn![Tag]) Or rstIn![Tag] = "" Then
rstIn.MoveNext
'If there IS text in the tag field call the function then loop
Else
'For the first record found with tags, record it's date for use on the report.
If booTagFound Then
rstIni.Edit
rstIni![DateFrom] = DateValue(rstIn![dtPictureTaken])
rstIni.Update
booTagFound = False
End If
Call funFindWords(rstIn![Tag])
rstIn.MoveNext
End If
'Increase the users counter
i = i + 1
Loop
[1] It examines the field for words which it puts into a seperate table used for counting occurances and associations. This works fine.
Thanks.
Mike.