This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
1
Weird things in loops
Post Body
I had to add an extra assignment to make my code work, does anyone know why?
Working code:
Dim tag_dic As Object
Set tag_dic = CreateObject("Scripting.Dictionary")
Dim apa As String
If rs1.RecordCount > 0 Then
rs1.MoveFirst
Do While Not rs1.EOF
apa = rs1!Tag
If (tag_dic.Exists(apa)) Then
With rsdup
.AddNew
rsdup!Tag = apa
rsdup!ID = (equ 1)
.Update
.Bookmark = .LastModified
End With
Else
tag_dic.Add apa, "a"
End If
equ = equ 1
End If
rs1.MoveNext
Loop
End If
If I take out the dummy variable "apa", and instead use the field "rs1!Tag" directly, the code doesn't work and everything gets added to the rsdup record set. How does field evaluation work in a loop?
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 11 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/vba/comment...