1

Topic: Check on all fields

Good afternoon. I can not solve a problem.
In the table there are some same fields with numerical values from 0 to 5.
It is necessary to make function which in record would define (true\false) that values of this field identical but provided that field value, "participating" is not equal in comparing 0. As argument of this function the number to which value in the table is compared is necessary. It can be made correctly? (Tried with If... AND...., but any heaping of checks turns out.

2

Re: Check on all fields

regina54;
Can the variant approaches

select a1, a2, a3, a4, a5, a6 from tab
where iif (nz (a1,0)> 0 and a1=a2 and a2=a3 and a3=a4 and a4=a5 and a5=a6) =true

3

Re: Check on all fields

The PENSIONER, thanks but how to be if, e.g., the field 3=0, i.e. does not participate in comparing? It turns out incorrectly

4

Re: Check on all fields

regina54
Check up
--Create basis
--Create the table
--Enter the data
[CSV = \] 0\1\3\4\5\6\
1\2\0\4\6\6
1\1\1\1\1\1
3\3\3\3\3\3
3\3\0\3\3\3
--Create request on the sample
Be convinced, whether it is correct - - there are lines 111111 and 333333

5

Re: Check on all fields

regina54 wrote:

the PENSIONER, thanks but how to be if, e.g., the field 3=0, i.e. does not participate in comparing? It turns out incorrectly

Here, look:
where iif (nz (a1,0)> 0 and a1=a2 and a2=a3.....
- At first nz (a1,0)> 0 we are convinced that a1 there is more than zero;
- Then a1=a2 we are convinced that in the same way a2 time equally a1 there is more than zero;
- And at last a2=a3 we are convinced of the same for a3 (if a3 = 0 the condition a2=a3 will not be fulfilled).
And so on.

6

Re: Check on all fields

regina54 , I truly understand that:
1) it is necessary to create function, instead of request?
2) it is necessary to select records in which all fields which values are not equal to zero, have the same value? Or have the same value set by you?

7

Re: Check on all fields

Decide what to do if a field () are empty or all 0

Function my (cod) ' argument a code field (counter)
Dim i, zn1, znTek, znSl, str
For i = 1 To 6
zn1 = DLookup ("ctl" AND i, "tbl", "id =" AND cod)
If zn1 <> 0 Then str = str AND zn1
Next
For i = 1 To Len (str) - 1
znTek = Mid (str, i, 1)
znSl = Mid (str, i + 1, 1)
If znTek = znSl Then
my = True
Else
my = False
Exit Function
End If
Next
End Function