I'm trying to display an ADO recordset in an access07 subform in datasheet view. Just a snapshot, read-only. The connection is successful, the recordset contains data, however, when I set the subform recordset no fields are displayed. The subform shows a vertical scrollbar, and when scrolling to the bottom it indicates the correct number of records, but it shows nothing, no fields, no columns.
This has to be something very simple that I'm missing. Any ideas?
EDIT: Here's a summary of the code that establishes the recordset.
Set cn = New ADODB.Connection
Set rsADO = New ADODB.Recordset
dbBackend = "C:\Users\Me\Desktop\TEST_Db_Backend.accdb"
sqlStr = "SELECT * FROM tblMaster;"
strConnect = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbBackend & ";User Id=;Password=;"
cn.CursorLocation = adUseClient
cn.ConnectionString = strConnect
cn.Open
If cn.State = adStateOpen Then
rsADO.Open sqlStr, cn, adOpenStatic, adLockReadOnly
End If
Set Me.PreviewPane.Form.Recordset = rsADO
rsADO.Close
cn.Close
Set rsADO = Nothing
Set cn = Nothing
Private Sub Form_Load()event procedure? If not, try moving it there and changingSet Me.PreviewPane.Form.Recordset = rsADOtoSet Me.Recordset = rsADO. I used the answer here: stackoverflow.com/questions/5641760/… - bf2020