• An index thing (97)

    Author
    Topic
    #393265

    I am opening a recordset from a table and trying to set the index of the recordset and then go to the first record.

    Set rst = dbs.OpenRecordset(“tblRates”, dbOpenDynaset)
    rst.Index = “SYM” ‘ . . . . . . . < = = = = = = = = = = = = ''KWVH this line tells me that "Operation is not supported for this type of object"
    rst.MoveFirst

    The second line shows that the operation is not supported. The tblRates has two indices, Pkey (Unique) and SYM(not unique). Is this another openDynaset vs Opentable thing?

    Any help is greatly appreciated.

    Ken

    Viewing 1 reply thread
    Author
    Replies
    • #711748

      You must have worked with xbase databases. In Access, the indexes are always set and you don’t have any control over which ones you use. If you want a different sort from the default, create a query and set the sort the way you wish and then open the recordset on that query instead of on the table.

      • #711752

        Charlotte,

        WOW! So how do I know what the default sort of the recordset is? I need to go through the records in a specific order, which coincidently is the order of one of the two indices.

        How would I open the query, using the following example?

        Set rst = dbs.OpenRecordset(“tblRates”, dbOpenDynaset)

        Thanks tons for your help.

        Ken

        • #711758

          Dim strSQL as String

          strSQL = “SELECT * FROM tblRates ORDER BY SYM”

          Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)

          • #711976

            Charlotte,

            duh, sorry. Had tunnel vision and a bf at the same time.

            thanks!

            Ke

          • #711977

            Charlotte,

            duh, sorry. Had tunnel vision and a bf at the same time.

            thanks!

            Ke

        • #711759

          Dim strSQL as String

          strSQL = “SELECT * FROM tblRates ORDER BY SYM”

          Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)

      • #711753

        Charlotte,

        WOW! So how do I know what the default sort of the recordset is? I need to go through the records in a specific order, which coincidently is the order of one of the two indices.

        How would I open the query, using the following example?

        Set rst = dbs.OpenRecordset(“tblRates”, dbOpenDynaset)

        Thanks tons for your help.

        Ken

    • #711749

      You must have worked with xbase databases. In Access, the indexes are always set and you don’t have any control over which ones you use. If you want a different sort from the default, create a query and set the sort the way you wish and then open the recordset on that query instead of on the table.

    Viewing 1 reply thread
    Reply To: An index thing (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: