DataCombo & VBA

Discussion in 'AutoCAD' started by André Dantas Rocha, Jul 14, 2004.

  1. Hi,

    I'm using the DAO360.dll and trying to connect the DataCombo with the
    recordset.
    When a run the project I receive an error in the line:
    Set DataCombo1.RowSource = rs
    "Wrong number of arguments or invalid property assingnmet"

    Any ideas?

    Thanks

    Public dbInfo As Database
    Public rsInfo As Recordset

    Private Sub UserForm_Initialize()
    Dim sql As String
    Dim rs As Recordset
    Set dbInfo = OpenDatabase("MSA.mdb")
    sql = "SELECT * FROM INSUMO"
    Set rs = dbInfo_OpenRecordset(sql, dbOpenDynamic)
    Set DataCombo1.RowSource = rs '<--- ERROR
    DataCombo1.ListField = "DS_INSUMO"
    DataCombo1.Refresh
    End Sub
     
    André Dantas Rocha, Jul 14, 2004
    #1
  2. Usually when this kind of error appears, the first
    thing to do is to try it without the 'Set' keyword

    DataCombo1.RowSource = rs
     
    Tony Tanzillo, Jul 14, 2004
    #2
  3. Still not working...

     
    André Dantas Rocha, Jul 14, 2004
    #3
  4. André Dantas Rocha

    Joe Sutphin Guest

    The RowSource property is expecting a string not an object reference [which
    is what your rs variable would hold]. Set is used to assign an object
    reference to a variable or property of compatiable data type.

    Also, I believe the RowSource property wants a range of cells from an Excel
    worksheet and not an Access database. Type "RowSource in the Immediate
    window of the AutoCAD VBAIDE and press F1 for further explanation. HTH.

    Joe
     
    Joe Sutphin, Jul 14, 2004
    #4
  5. André Dantas Rocha

    Dragnsbld Guest

    try setting it to the actual field of the rst you want to use in that cbo.
     
    Dragnsbld, Jul 14, 2004
    #5
  6. André Dantas Rocha

    Dragnsbld Guest

    OOPS! sorry bad info. I am trying to remember the solution to your problem. I had the same problem back about 4 years on one of my projects.
    If I can find it or remember how to get around the problem I'll get back to you.
     
    Dragnsbld, Jul 14, 2004
    #6
  7. Thanks, I'll wait for your response...

    problem. I had the same problem back about 4 years on one of my projects.
    to you.
     
    André Dantas Rocha, Jul 14, 2004
    #7
  8. André Dantas Rocha

    Joe Sutphin Guest

    Look up, look up ...

     
    Joe Sutphin, Jul 14, 2004
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.