Record bookmarking

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dan2kx
    Contributor
    • Oct 2007
    • 365

    Record bookmarking

    Good evening Peeps

    got another question....

    OK, i have a continous form with tick boxes, the idea is that (currently a single record) is selected and then that record number is used in the openargs for another form which goes to the bookmark for that record.... with me so far??

    I would like to know if it is possible to bookmark multiple record(ID's) and then skip through then on the second form?

    if this is possible how would one accomplish this assuming i parse multiple "ID's" in the openargs seperated by commas or such like....

    Hope this makes sense (does to me)

    Thanks,

    Dan

    PS, just had an interim thought... what if i changed the record source into a query (on this opening) and used the parse in a query (WHERE IN), any alternatives? would that work?
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    I believe it would be easier to create a filter string from the selected records, and use that in the filter argument to the DoCmd.OpenForm.

    Comment

    • Dan2kx
      Contributor
      • Oct 2007
      • 365

      #3
      could you point me in a direction for this, never used filters... any good literature would do, unless you are really bored and want to provide me with an example...

      Dan

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        I'm sorry, filter was the wrong term. I mean create a string to use in the WhereCondition, which would filter the records in the other form.

        Comment

        • Dan2kx
          Contributor
          • Oct 2007
          • 365

          #5
          does it need to be formatted in a particular way? EG
          Code:
          Me.RandomID=1,2,3,4,5,6,7,8,9

          Comment

          • ChipR
            Recognized Expert Top Contributor
            • Jul 2008
            • 1289

            #6
            Yes, but you will be familiar with the syntax :)
            From OpenForm Method [http://msdn.microsoft.com/en-us/libr...fice.10).aspx],
            WhereCondition Optional Variant. A string expression that's a valid SQL WHERE clause without the word WHERE.

            Comment

            • ChipR
              Recognized Expert Top Contributor
              • Jul 2008
              • 1289

              #7
              Now, if you are using this to open a form showing only records that are checked, I suppose you will have to loop through records to create the string. Here's some quick pseudocode so you can see what I mean:
              Code:
              Sub cmdOpen_Click()
                Dim strWhere As String
                [loop through records that are checked]
                  strWhere = strWhere & "[PKField] = """ & record!field & """ OR "
                [end loop]
                If strWhere > "" Then
                  strWhere = Left(strWhere, Len(strWhere - 3))
                End If
                DoCmd.OpenForm "myOtherForm", , , strWhere
              End Sub

              Comment

              • Dan2kx
                Contributor
                • Oct 2007
                • 365

                #8
                Can you use

                ............. , IN (1,2,3,4,5,6)

                then??

                Comment

                • ChipR
                  Recognized Expert Top Contributor
                  • Jul 2008
                  • 1289

                  #9
                  Quite possibly, but I haven't familiarized myself with the syntax for IN yet. The code would be very similar.

                  Comment

                  • ChipR
                    Recognized Expert Top Contributor
                    • Jul 2008
                    • 1289

                    #10
                    Sorry, in that code it should have been
                    Code:
                    ..."[PKField] = """ & record!field & """ OR "
                    Going to edit that post, but wanted to point it out. Too much working on C++ lately.

                    Comment

                    • Dan2kx
                      Contributor
                      • Oct 2007
                      • 365

                      #11
                      i'll give it a whirl then, i like WHERE IN, it looks prettier and is much easier than constructing all the = OR stuff, its basicaly the same

                      If using in SQL (from query builder) as a where clause simply

                      IN (LIST,LIST,,,,, ,,) etc

                      very good!!

                      Thanks for the help, and so speedy too!!!

                      Comment

                      • Dan2kx
                        Contributor
                        • Oct 2007
                        • 365

                        #12
                        New Question



                        Dan

                        Comment

                        Working...