• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Troubleshooting

Cursor Types for the Form.Recordset Property

Q1:I receive a "The object you entered is not a valid Recordset property" message when I assign my ADODB.Recordset to the Recordset property of a form.
The Recordset you created has a ForwardOnly or Dynamic cursor, or has a server-side cursor. Binding a form to a Recordset you create with code requires CursorLocation = adUseClient; the CursorType property must be set to adOpenKeyset or adOpenStatic; and the LockType can't be adLockReadOnly. The standard code for opening an updatable Recordset is
With rstName
   Set .ActiveConnection = cnnName
   .CursorLocation = adUseClient
   .CursorType = adOpenStatic 'or adOpenKeyset
   .LockType = adLockOptimistic
   .Open strSQL
End With

MSDataShape and SQLOLEDB Providers

Q1: I've opened a Recordset against an MSDE table with a client-side Keyset cursor that has a tentative append record in Datasheet view of my form, but I can't edit any cells.
You must specify MSDataShape as the Provider property of the ADODB.Connection and then include Data Provider=SQLOLEDB[.1] in the ConnectionString. (The .1 version number is optional.) The typical code for opening on a local copy of MSDE a connection that lets you generate an updatable Recordset for a form is:
With cnnName
   .Provider = "MSDataShape"
   .Open "Data Provider=SQLOLEDB.1;Data Source=(local);" & _
      "UID=sa;PWD=;Database=DBName"
End With


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint