Navigate recordsets in a loop

Xiazer

New member
Local time
Today, 13:34
Joined
Jan 23, 2009
Messages
8
I have two recordsets that I am trying to compare two lists of 5 things. So is this possible?

Code:
If ViewPicks("# " + placeholder + " Prediction") = Forms![WeekendResults]("Number " & placeholder) Then
Note: I have this working when I don't try to use the placeholder variable.

Did I do it wrong?
 
Yo X:
You haven't provided enough information for anyone to help you.
Describe the problem in extreme detail.
What it the 'placeholder?' What is ViewPicks()? When it fails, how do you know? Error? Wrong answer?
All the best,
 
The code it self works when presented like this
Code:
If ViewPicks("# 1 Prediction") = Forms![WeekendResults]("Number 1") Then

I just want to know if it is possible to fit this in a loop where the number within "ViewPicks(# 1 Prediction")" can be changed with a placeholder variable so on the next loop it would be read as "ViewPicks(# 2 Prediction")" and so on.

Although ViewPicks is a recordset. and "Number 1" is a textbox and the error I get is "Run-tim error '13': Type Mismatch.

Thanks again.

Q
 
You need to structure your variables correctly

If ViewPicks("# " & placeholder & " Prediction") .....
 
Thanks for the help! I finally got it to work, Turns out I needed to set it to a variable then put it in the loop to get it to work, I couldn't set it inside the if statement like this:

Code:
TableContents = "# " & PickNumber & " Prediction"
FormContents = "Number " & PickNumber
... 
If StrComp(ViewPicks(TableContents), Forms![WeekendResults](FormContents), 1) Then

Thanks again!

Q
 

Users who are viewing this thread

Back
Top Bottom