Results 1 to 3 of 3
  1. #1
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614

    Continuous Form : Conditional Formatting

    I have applied conditional formatting for a continuous form based on the date. The form (subform )displays all dates of month and if a particular day is a holiday, the row has to be highlighted. In other words, the formatting fails to apply if the holiday is at the start of the month.I have tested for few dates and 12th was the earliest date where formatting was applied successfully.I have holidays stored in a different table and I have used [MyDateField]=Dlookup("HolidayDate","Holidays") as condition for formatting.

    Is there a way to re-apply the formatting after the form is completely loaded ? When the data is loaded in any form, when does the conditional formatting (sequence of events) takes place ?

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I don't think that timing is the problem, here! You don't have any Value for the Criteria portion of the DLookup Function, and if you don't supply a Value for Criteria, DLookup returns a random value from the Table or Query, it doesn't tell you, in this case, if [MyDateField] is found in the Holidays Table.

    I think you actually need to use 'Expression Is' under the 'Condition' dropdown, and then use DCount, like this, for the condition

    Code:
    DCount("*", "Holidays", "[HolidayDate] = #" & [MyDateField] & "#")> 0

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Thanks, Missinglinq. DCount("*", "Holidays", "[HolidayDate] = #" & Format([MyDateField],"mm\/dd\/yyyy") & "#")> 0 is working!!

    The problem was with the date format as well.



    A new thing I learnt "if you don't supply a Value for Criteria, DLookup returns a random value from the Table or Query"


Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 10-01-2012, 07:59 AM
  2. Conditional formatting inside a form
    By DataRick in forum Programming
    Replies: 14
    Last Post: 02-12-2012, 06:23 PM
  3. Replies: 5
    Last Post: 05-02-2011, 11:02 AM
  4. Conditional formatting on form
    By ngruson in forum Forms
    Replies: 11
    Last Post: 09-17-2010, 12:15 PM
  5. Conditional Formatting (on Open form?)
    By christopheb in forum Forms
    Replies: 0
    Last Post: 03-16-2010, 07:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums