Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369

    Question Unanswered: changing bgcolor for every second set of records

    I have a form/query that returns a set of records based on a combination of 3 fields, and only where there are 2 or more hits in the db.

    So the results could be several groups of 2,3,4 or more records related to each unique combination of those 3 fields mentioned above.

    What I want is to set the background color of each second GROUP of records to another color,for easy reading. The number of records in each group will vary, so I must check against the unique combination of those 3 fields.

    How do I do this best? (using vba and Continous form)

    D.
    Win-XP pro, Access 2002, ADO 2.7, DAO 3.6. English versions of apps/OS.

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Have a Look

  3. #3
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369

    Question

    Quote Originally Posted by hammbakka
    Have a Look
    OK, interesting, how does this actually work:
    =IIf([Text26] Mod 2;[Text26];"")

    (the row source of the sub form: my question is about the syntax, what Mod 2 is.)

    Had a quick look and seemed that this db is storing yes/no values in the actual table to keep track of which record to highlight, probably updated according to the sorting wanted, to ensure that every second is highlighted differently.
    Better doing that temporarily in memory to avoid updating the records unnecessarily. But thanks for the sample, interesting indeed. Will see what I can make of it.

    However, is this a "simple solution"? Any other ways of highlighting certain records based on a grouping done by the query? I think a rst/vba check would be more elegant, if possible, but how to identify the individual records?

    D.
    Win-XP pro, Access 2002, ADO 2.7, DAO 3.6. English versions of apps/OS.

  4. #4
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Mod is a special kind of division.I forget the details, but is used often in programming...

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Quote Originally Posted by rguy84
    Mod is a special kind of division.I forget the details, but is used often in programming...
    Mod computes the rest when you divide X by Y

  6. #6
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369

    Question

    Quote Originally Posted by hammbakka
    Mod computes the rest when you divide X by Y
    OK, so what exactly is happening here:?
    =IIf([Text26] Mod 2;[Text26];"")

    Take the content of Text26, divide by 2 and store the rest back into Text26?

    D.
    Win-XP pro, Access 2002, ADO 2.7, DAO 3.6. English versions of apps/OS.

  7. #7
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    =IIf([Text26] Mod 2;[Text26];"") Means

    If the rest of dividing Text26 / 2 <> 0 then writes then writes the rest in Text26 otherwise (if the rest = 0) writes Leer i.e empty string

Posting Permissions

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