Hi,
you can use TypeOf:
If TypeOf rst Is DAO.Recordset Then
'DAO
else
'ado
end if
--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
Cheryl,
Thanks for the links, both are very helpful.
In my case (mdb), I am setting the form's recordset property directly,
sometimes with a DAO others with an ADO recordset. I got stuck when trying
to implement a function to sort the recordset bound to the form. This
procedure use Form.RecordsetClone in order to get a clone of the recordset
bound to the form but because DAO and ADO implement the Sort property in
different way, I need to know what kind it is in order to continue.
Example:
private sortCol as string
private sortDir as string
private sub SortRst(colName as string)
dim rst as object
if sortCol <> colName then
sortCol = colName
sortDir = "ASC"
else
if sortDir = "ASC" then
sortDir = "DESC"
else
sortDir = "ASC"
end if
end if
set rst = me.recordsetClone
rst.Sort = colName & " " & sortDir
if rst is ADO then
set me.recordset = rst
else
set me.recordset = rst.OpenRecordset
endif
set rst = nothing
end sub
Regards,
AMB