Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    13

    Question Unanswered: recordsource property

    I am somewhat new to Access but not VB. I am getting "invalid use of property" at this line of code:

    Set Me.sfrm_ARCall_List.Form.RecordSource = qrySltARCustID

    I have a main form (frm_ARCall_Slt) and a subform (sfrm_ARCall_List). The main form is an unbounded form that I use to search a query for certain criteria. The subform is bounded to a query.

    Am I missing a ADO and/or RecordSet code (I have none at this time - assuming it's not needed due to the code being inside the mdb.).

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Try

    Me.sfrm_ARCall_List.Form.RecordSource = "qrySltARCustID"
    Paul

  3. #3
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    Yup the syntax Paul used is spot on. I just though it might be worth mentioning why. The RecordSource property is not a pointer to a DAO or ADO RecordSet object as the RecordSet property in any number of VB6 controls would be. Although forms do have a Recordset object property from Access 2000 onwards.

    The VBA properties tend to be strings rather than objects, at least in the properties dialogue boxes. Another example would be how it handles Font properties i.e individual properties rather a link to a dialogue box allow you to set the properties of a Font object. The forms, reports, and controls also tend to be collections of common VB controls e.g. forms have scroll bars and DataSource controls "built in".

    Usually you can code in a more object orientated way in the VBA editor, but it does require more work and makes it a little less RAD. The VBA philosphy has been to make it visually less heirachical for frequently used/set properties. You've less control, but it makes it easier to get going which is fair enough considering the target audience ain't the coding community...horses for courses.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •