hello to all
By studying examples in this forum, I'm slowly getting better at
programming. When I see a line like the one shown below, exactly what does
the (0) mean? When I look up OpenRecordset in VBA help, I don't see any
arguments following the first set of brackets.
strRank = CurrentDb.OpenRecordset(strSQL)(0)
thanks
cinnie

Signature
cinnie
Tom van Stiphout - 16 Jan 2008 03:35 GMT
Don't look at OpenRecordset, but at Recordset Object. That's what
"CurrentDb.OpenRecordset(strSQL)" returns.
Then you can take the 0-est element of that recordset (the first field
in the first record), and assign it to a string value.
More long-winded this could be rewritten as:
dim rs as recordset
set rs = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
if rs.recordcount > 0 then
'Recordset pointer is at first record.
strRank = rs.Fields("SomeFieldName").Value
-Tom.
>hello to all
>
[quoted text clipped - 7 lines]
>thanks
>cinnie