Unanswered: Reference subform recordset from main form
This one OUGHT to be easy, but I've gone blank once again.. lunch was hard on me :-)
Dim udvalg As ADODB.Recordset
Set udvalg = New ADODB.Recordset
Dim forbindelse As ADODB.Connection
Set forbindelse = New ADODB.Connection
Dim SQL As String
SQL = "SELECT * FROM md_vw_trackoplysninger WHERE MUSAnummer = " & Str(md_vw_trackoplysninger.Value)
forbindelse.Open "provider=SQLOLEDB;Data source=DB;initial catalog=UDV;User ID=AccessBruger;Password="
Set udvalg.ActiveConnection = forbindelse
udvalg.Source = SQL
udvalg.Locktype = adLockReadOnly
udvalg.CursorLocation = adUseClient
Set Me.subform_udvalg. here's my problem, how to reference the recordset property
Set udvalg = Nothing
Set forbindelse = Nothing
Its pretty straight forward, a button on my main form is set to create a SQL string with a where clause based on a textbox. Once the where value has been fetched, its to create an ADO sql-server recordset, and pass it on to my subforms recordset.
Doing a "me.recordset" on the subforms form.open is easy, but I never can get the object and property model right.
Thanks in advance
EDIT: Ah, got it: Set Me.subform_udvalg.Form.Recordset = udvalg
Last edited by Trinsan; 01-24-06 at 08:21.
IT squid: networks, servers, firewalls, routers and I dabble a little with SQL-server and Access as well....