View Single Post
  #2 (permalink)  
Old October 9th, 2003, 01:59 PM
Bob Bedell Bob Bedell is offline
Friend of Wrox
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts

How do I get each recordset to populate each record on the form?
Unfortunately you can't. There isn't any way to assign unbound control values from a Recordset object if the form is displayed in continuous or datasheet view.

If you were using a .mdb file, you could cache the recordset in a temp table, then bind to the temp table. Since you're using a .adp file, though, you don't have the local storage option. What I have seen done ("Microsoft Access Developer's Guide to SQl Server") is the use of a local XML file to cache local data, with code like the following:

'Create a client-side recordset.
  Set rst = New ADODB.Recordset
  rst.CursorLocation = adUseClient
  rst.CursorType = adOpenStatic
  rst.LockType = adLockReadOnly
  'Find or create the XML file,
  ' and open the recordset.
  If Len(Dir(strFile)) > 0 Then
      'File was found. Open recordset from the file.
      rst.Open Source:=strFile, Options:=adCmdFile
      'File wasn't found.
      'Open recordset using the Row Source,
      ' and create the XML file.
      rst.ActiveConnection = _
      rst.Open Source:=ctl.RowSource
      rst.Save strFile, adPersistXML
      Set rst.ActiveConnection = Nothing
  End If

The source code for the book I cited above is available from the Sam's Publishing web site if you want to look into this technique a little further. It works well, but isn't exactly trivial to implement.



Reply With Quote