Results 1 to 6 of 6
  1. #1
    Mattbro is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    100

    Update


    Hi Everyone,
    Access 2013, my Db has 4 tables. TbA,TbB,TbC and TbCalendar. TbA, B and C relate to tasks that need to be performed periodically. A query to each table (QryA, QryB and QryC with Left joins on the Tbl Calendar) populates 3 Forms FrmA, FrmB and FrmC respectively. Each form allows the user to record the task findings, date performed and their initials.
    The Queries ask if the task has been performed within the last week/day/month. If they have, then the data will still appear on Form A, B or C. If it has not, said form will be blank. E.G for a daily task:
    Code:
    SELECT TbA.Temp, TbA.DateTaken, TbA.Name, TbCalendar.Date
    FROM TbCalendar LEFT JOIN TbA ON TbCalendar.Date = TbA.DateTaken WHERE (((TbA.DateTaken)=Date()));
    I have 3 small forms (SbA, SbB and SbC) each has 1 textbox fed off each query and are coded to have backcolour.red if null. These are on the ‘switchboard’ form so user opens up Db and sees if tasks need performing if textboxes are red. All works as required.
    My problem is that when they have performed the task, the textbox stays red until closing and reopening the Db. I have played with Requery and Refresh using the ‘GetonFocus properties of the ‘subforms’;
    Code:
    Private Sub Form_GotFocus()
    Me!Week.Requery
    Me!Week.Refresh
    Me!Week.Repaint
    End Sub
    But various combinations of the above pay no dividends. If anyone has any advice, I would be grateful.Hi Everyone,
    Last edited by June7; 04-20-2014 at 10:44 AM.

  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,770
    Just requerying or repainting the form is not enough, must set the BackColor property.

    Maybe instead textbox Conditional Formatting can be applied.
    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
    Mattbro is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    100
    Hello June7. Truth is, I started out with conditional formatting. Same problem, so moved to code. I have just knocked up a workaround in which I have moved the 3 small forms onto another form, which loads at startup in popup form along with the switchboard. It does the job, but it doesn't look as good as just having the indicators on the main switchboard page....

  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,770
    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.

  5. #5
    Mattbro is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    100
    DB3.zip
    Hi June7-Db attached....I think....

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Options - all would use conditional formatting on textboxes that have count expressions:

    1. Frm1 has RecordSource that includes counts of each task type, like:
    SELECT TblCalendar2014.Date, TblCalendar2014.Week, Count(QueryDecon.NameDecontamination) AS CountOfNameDecontamination, Count(QueryFridge.NameFridge) AS CountOfNameFridge, Count(QueryAnemometer.NameAnemometer) AS CountOfNameAnemometer
    FROM ((TblCalendar2014 LEFT JOIN QueryAnemometer ON TblCalendar2014.Date = QueryAnemometer.Date) LEFT JOIN QueryDecon ON TblCalendar2014.Date = QueryDecon.Date) LEFT JOIN QueryFridge ON TblCalendar2014.Date = QueryFridge.Date
    WHERE (((TblCalendar2014.Day)="Monday"))
    GROUP BY TblCalendar2014.Date, TblCalendar2014.Week;

    2. Frm1 is unbound and textboxes on main form with DCount() expressions in ControlSource

    3. Frm1 is unbound and textbox in subform footer section with Count(*) expression in ControlSource

    You have dates formatted as dd/mm/yyyy which is not Access standard. I don't know how you are inputting the date values but using non-Access standard can be problematic. Review http://allenbrowne.com/ser-36.html
    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.

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

Similar Threads

  1. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  2. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  3. Replies: 4
    Last Post: 11-10-2011, 03:41 PM
  4. Replies: 1
    Last Post: 01-22-2011, 12:23 PM
  5. Update field in table after update on a subform
    By jpkeller55 in forum Queries
    Replies: 3
    Last Post: 09-30-2010, 08:02 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