Single record as variable

  • Thread starter Thread starter Guest
  • Start date Start date
How can I send a single record in a recordset to another procedure?

There is no object that corresponds to a single record. You could either
send the whole recordset:

PrintMyRecord rs

Public Sub PrintMyRecord(SomeRecordset As DAO.Recordset)

If SomeRecordset.EOF Then Exit Sub ' etc etc



or if you really need to restrict the argument to one record, you could
construct an array to hold the field values:

Dim ar() as Variant

ReDim ar(rs.Fields.Count-1)
For i = 0 to rs.Fields.Count -1
ar(i) = rs.Fields(i)
Next i

PrintMyRecord ar


There are probably other ways too.
Hope it helps


Tim F
 
You could write code that would put each field in the record in a parameter
array and pass it. Or, you could reference the primary key or what ever you
need to identify the record, pass that to the procedure and put code in the
procedure to retreive the record.
 
Back
Top