I got a short question. Is there any difference in VBA between
if x1 and x2 and x3 and ... and x10 then
foo
end if
and
if x1 then
if x2 then
if x3 then
...
foo
end if
end if
end if
regarding speed?
More specifically: I have 10 columns with data and need to compare the data row by row for duplicates in the database (stuff like SELECT DISTINCT won't work in this case).
I could imagine, that using
x1 = recordset.fields("Field1").value
if x1 then
x2 = recordset.fields("Field2").value
if x2 then
x3 = recordset.fields("Field3").value
if x3 then
...
foo
end if
end if
end if
will be faster than
x1 = recordset.fields("Field1").value
x2 = recordset.fields("Field2").value
...
if x1 and x2 and x3 and ... and x10 then
foo
end if
since I won't have to read all the data from the recordset. Or will the amount of ifs kill this advantage regarding speed?