Results 1 to 9 of 9
  1. #1
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262

    Pre-loaded timestamp immune to conditional formatting

    Refers to thread: https://www.accessforums.net/access/...tml#post238297

    I have conditional formatting on a form with fields that are short dates. If I preload this date from a corresponding drop down, the formatting does not carry over. If I manually re-click the date in the calendar, the formatting executes. But I'm not going to re-click my date every time I pre-load a timestamp. So, how do I get around this?

    Current formatting rules for a short date field:

    Click image for larger version. 

Name:	CF1.png 
Views:	7 
Size:	39.6 KB 
ID:	17999

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    The date is picked from a combobox but the Conditional Formatting is on a textbox? The textbox is UNBOUND with an expression in ControlSource that references the combobox?

    Conditional Formatting can be applied to a combobox.

    I tested these arrangements and all work. Cannot replicate issue.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    The date is filled based on a selection from a combobox. Two separate boxes that are related. For example, I pick a QtyA of 100 from my combobox, and if the qty already exists in the table, a date pops up that is stored in the table of when this QtyA was entered. Screenshots of an example:

    Click image for larger version. 

Name:	qty1.png 
Views:	6 
Size:	32.8 KB 
ID:	18000Click image for larger version. 

Name:	qty2.png 
Views:	6 
Size:	36.2 KB 
ID:	18001Click image for larger version. 

Name:	qty3.png 
Views:	6 
Size:	35.9 KB 
ID:	18002

    The 8/15/2014 should be green upon being filled into the field, but it is not. If I click the little calender icon and choose the same date and then move focus outside of the field, it turns green.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    What is the expression or code that populates the textbox?

    Maybe wrap in CDate() function.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    A simple column reference:

    Code:
    Private Sub cboQtyA_AfterUpdate()
    'When a preset QtyA is entered, fill in the corresponding price, date, and vendor
    
    
    Me.txtUnitPriceA = Me.cboQtyA.Column(1)
    Me.txtPriceADate = Me.cboQtyA.Column(2)
    Me.txtVendorA = Me.cboQtyA.Column(3)
    
    
    End Sub

  6. #6
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    Just fyi, the source table of all of this info has the same conditional formatting and it works fine >_<

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    What do you mean the source table has conditional formatting? AFAIK, table fields cannot have conditional formatting.

    Try:
    CDate(Me.cboQtyA.Column(2))
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Are you sure your code is actually putting a date value in the unbound text box, and not just the text representation of a date?

    As june7 suggested, try using Me.txtPriceADate = CDate(Me.cboQtyA.Column(2)) to force the conversion to an actual date value.

  9. #9
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    You're right, the table does not have the conditional formatting. The split form associated with it has the formatting. My apologies

    Click image for larger version. 

Name:	qty4.jpg 
Views:	5 
Size:	197.9 KB 
ID:	18007

    The associated table contains the date, so I assume it is a true value and not just a representation.

    The CDate() wrap worked Thank you!

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

Similar Threads

  1. Replies: 6
    Last Post: 05-26-2013, 09:10 PM
  2. conditional formatting
    By michele in forum Forms
    Replies: 6
    Last Post: 02-01-2012, 01:16 PM
  3. Conditional Formatting
    By Paul H in forum Reports
    Replies: 3
    Last Post: 11-07-2011, 11:59 AM
  4. Conditional Formatting
    By mm07nkb in forum Forms
    Replies: 1
    Last Post: 09-02-2011, 09:58 AM
  5. Conditional Formatting
    By DanOzDirect in forum Reports
    Replies: 3
    Last Post: 07-21-2010, 08:49 PM

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