Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why doesn't this work?

Status
Not open for further replies.

TCARPENTER

Programmer
Mar 11, 2002
766
US
I have a simple form with a combo box, and in the after update event I have this chunk of code:

Code:
Private Sub cboTables_AfterUpdate()
  Dim rs As New ADODB.Recordset
  Dim cn As New ADODB.Connection
  Dim strTableName As String
  
  strTableName = Me.cboTables.Value
  
  Set cn = CurrentProject.Connection
   
  Set rs = cn.OpenSchema(adSchemaTables, _
         Array(Empty, Empty, Empty, "Table"))
         
  Set rs = cn.OpenSchema(adSchemaColumns, Array(Empty, Empty, strTableName, Empty))

  [red]Set Me.sfmEnumFields.Form.Recordset = rs[/red]
  
End Sub

The recordset has values, but I keep getting this error at the line above in red:

Run-time error '7965':

The object you entered is not a valid Recordset property.

Any help would be appreciated.

Thanks
Todd
 
I guess that Me.sfmEnumFields.Form.Recordset is a DAO recordset.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV,

Thanks for the response, I should have mentioned the sub form is unbound.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top