Recordset error

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
 
G

George Nicholson

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top