How to set values in different records?

diakis

Registered User.
Local time
Today, 16:03
Joined
Jul 4, 2006
Messages
16
Hi,
I work with Access 2003 and I am new in VBA.
I would like some help with the following:
In a query that is sorted by field1 (this is the primary key)
I want to write this:

If field2.record(m)=field2.record (n) Then field3.record (p)="Yes" Else field3.record (p)="No"

field2 and field3 are texts
fields1 is a number
(m), (n), (p) are the numbers of records by which we must move from the first record in this query, if it sorted by field1

Thank you in advance.
 
Can you use actual examples it makes for better understanding.

Don't get what you mean If field2.record(m)=field2.record (n)
 
Dcrake,
Perhaps it is very simple but I don’t know how to do it.

If field2.record(m)=field2.record (n) Then field3.record (p)="Yes" Else field3.record (p)="No"

Example1
field1 field2 field3
1 a No
2 b No
3 c No
4 a No
5 d No
6 e No
7 c No
8 d No
9 e Yes
10 a No
If m=3, n=7 and p=9
In example1 set at field3.record(9) value “Yes” because field2.record(3)=field2.record (7)


Example2
field1 field2 field3
1 a No
2 b No
3 c No
4 a No
5 d No
6 e No
7 c No
8 d No
9 e No
10 a No

If m=2, n=8 and p=10
In example2 keep at field3.record(10) value “No” because field2.record(2)<>field2.record (8)
 
I am a little bit clearer but what is the object of the exercise? what are you trying to acheive?
 

Users who are viewing this thread

Back
Top Bottom