Recordset error

  • Thread starter Thread starter Alexis
  • Start date Start date
A

Alexis

I am fairly new to writing codes, I get an error
saying "type mismatch" when I try setting the recordset of
a form. This is my code, can someone help.

Function ReturnUserRoster()
Dim cnn As New ADODB.Connection
Dim rst As ADODB.Recordset
Dim frm As Form
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=\\us504s47\e\PBSGDATA\Secure.mdw"
Set rst = cnn.OpenSchema(adSchemaProviderSpecific _
, , JET_SCHEMA_USERROSTER)
Set frm = Forms!who
frm.RecordSource = rst
Set rst = Nothing
Set cnn = Nothing
End Function
 
The Form.RecordSource property expects a string, not a recordset object,
hence "Type Mismatch"

However, the Form.Recordset property should accept a recordset object as
long as you have a version of Access that supports it with ADO (if I
remember correctly this property only supported DAO objects pre XP but
supports either DAO or ADO in XP & later)

Hope this helps,
 
Back
Top