C
Chris Strug
Hi,
I'm not even sure if this is possible so bear with me but...
I have a form for data input. The form contains a sub form showing linked
records to the record from the main form.
What I'd like to do is create a recordset in ADO and assign it as the
recordsource of the sub form. However I'm having a few problems....
Is what I'm trying to achieve possible and if so where am I going wrong?
E.g..
Private Sub Form_Open(Cancel As Integer)
dim rstAddress as ADODB.recordset
Set rstAddress = New ADODB.Recordset
With rstAddress
With .Fields
.Append "Address_ID", adInteger
.Append "Address_1", adVarChar, 40
.Append "Address_2", adVarChar, 40
.Append "Address_3", adVarChar, 40
.Append "Address_4", adVarChar, 40
.Append "Address_Postcode", adVarChar, 40
End With
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open
End With
Set Me!subfrm.Form.Recordset = rstAddress
End Sub
The recordset creates fine but when I try to bind it to the form as its
recordsource (the last line in the sub) I get the error: "The Object your
entered is not a valid recordset property".
I'm using an Access 2000 (with service packs) ADP project linked to SQLS
2000.
Any and all advice is gratefully received.
Kind thanks
Chris Strug
I'm not even sure if this is possible so bear with me but...
I have a form for data input. The form contains a sub form showing linked
records to the record from the main form.
What I'd like to do is create a recordset in ADO and assign it as the
recordsource of the sub form. However I'm having a few problems....
Is what I'm trying to achieve possible and if so where am I going wrong?
E.g..
Private Sub Form_Open(Cancel As Integer)
dim rstAddress as ADODB.recordset
Set rstAddress = New ADODB.Recordset
With rstAddress
With .Fields
.Append "Address_ID", adInteger
.Append "Address_1", adVarChar, 40
.Append "Address_2", adVarChar, 40
.Append "Address_3", adVarChar, 40
.Append "Address_4", adVarChar, 40
.Append "Address_Postcode", adVarChar, 40
End With
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open
End With
Set Me!subfrm.Form.Recordset = rstAddress
End Sub
The recordset creates fine but when I try to bind it to the form as its
recordsource (the last line in the sub) I get the error: "The Object your
entered is not a valid recordset property".
I'm using an Access 2000 (with service packs) ADP project linked to SQLS
2000.
Any and all advice is gratefully received.
Kind thanks
Chris Strug