Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Then need apostrophe delimiters:

    "[Machine/Plant]='" & Me.Combo35 & "' AND
    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.

  2. #17
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37
    Well, whilst waiting for your reply I thought ah, I need the single 's somewhere because its text. I did put it around the bit you said as in example above, but i didnt try it.

    So, I have just updated as you suggest above, filled out some new records with different dates - all in october - and it WORKS!!

    I will tweak msg box msg, etc.



    I dont want to complicate things too much, but is it also possible to use the code in conjunction with the type of maintenance. On each record, the engineer selects the type of maintenance - project work, unplanned maintenance, planned maintenance, preventative maintenance, health and safety, etc.

    Would it be possible to have the count for say 6 UNPLANNED mrfs?

    Excellent, thank you for your help, very much appreciated.

    Rek

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Put as many criteria as you want in the DCount.

    How do you know an mrf is unplanned?
    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.

  4. #19
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37
    Unplanned Maintenance requests would cover reactive maintenance. The user would select the type of maintenance from another combo box on the form. This way I can query to calculate how many unplanned MRFs and Man hours there are per month, and on which machine, which department etc.

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    But what distinguishes an mrf record as 'unplanned' - what criteria could be used as filter? 'Reactive' is a maintenance type choice?
    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.

  6. #21
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37
    All that distinguishes an MRF as "Unplanned Maintenance", or any other type of Maintenance (Planned, Preventative, etc) is the selection from a combo box list, fieldname " Type of Activity", as belowClick image for larger version. 

Name:	Screenshot Spirit Tabbed Form.png 
Views:	6 
Size:	75.8 KB 
ID:	22372

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Okay if you don't want to count unplanned, then use that as conditional criteria in the code. Don't need to trigger the code if user selects Unplanned. Something like:

    If Me.cbxActivity <> "Unplanned Maintenance" Then
    If DCount("*", "[Tbl_STS Maintenance Activity]", "[Machine/Plant]='" & Me.Combo35 & "' AND Format([Date Issued], 'YYYYMM') = Format(Date(), 'YYYYMM') AND [Activity]<>'Unplanned Maintenance'") + 1 >= 6 Then
    MsgBox "something"
    End If
    End If

    If you actually save an ID into the Activity field, then the expressions would use the ID number instead of text "Unplanned Maintenance". Number field would not use quote or apostrophe marks for parameters.
    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. #23
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37
    I do want to only include unplanned maintenance.
    I spoke to the guys today and gave them a demo of how the system will bring up a message box, and their concern was that if MRFs for ALL maintenance types were counted, then the likelihood would be that the message box would annoy them.

    Also, from a Maintenance point of view, we are not too concerned about planned maintenance or for example project work, for this is work that we plan around production to do, so there is no negative impact.

    If however, a machine had 5 or 6 instances of Unplanned Maintenance, it may indicate that the process/machine is trending toward failure, which will impact on production impact.

    Therefore I think it would be better to ONLY count MRFs for Unplanned Maintenance.

  9. #24
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Okay, I had that backwards. Adjust code as appropriate. Change the logical operator from <> to =.
    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.

  10. #25
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37
    Brilliant!

    Ok, last question - how do I format the message box?

    the code now looks like this ...

    Private Sub Combo35_AfterUpdate()
    If Me.[Type of Activity] = "Unplanned Maintenance" Then
    If DCount("*", "[Tbl_STS Maintenance Activity]", "[Machine/Plant]='" & Me.Combo35 & "' AND Format([Date Issued], 'YYYYMM') = Format(Date(), 'YYYYMM') AND [Type of Activity] = 'Unplanned Maintenance'") + 1 >= 5 Then
    MsgBox "The following machine has had 5 or more MRFs so far this month. " & Me.[Machine/Plant] & ". This may indicate a trend towards failure, and may require assessment or a change to the frequency of Preventative Maintenance. Please inform the Maintenance Manager immediately."
    End If


    End If
    End Sub

    I will change the actual message a little, but I would like the machine name to stand out a little, perhaps on a line by itself, so that it looks like ...


    "The following machine has had blah blah blah

    CUT SHEET LAMINATOR

    This may indicate a trend toward failure blah blah blah"


    How would I do that?

  11. #26
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You can format the Machine/Plant value to display as all upper case: UCase(Me.Machine/Plant)

    Use vbCrLf to force multiple lines.

    MsgBox "The following machine has had 5 or more MRFs so far this month. " & vbCrLf & vbCrLf & UCase(Me.Machine/Plant) & vbCrLf & vbCrLf & "This may indicate a trend towards failure, and may require assessment or a change to the frequency of Preventative Maintenance. Please inform the Maintenance Manager immediately."
    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.

  12. #27
    Rek 1969 is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    37
    Perfect!!

    Hey, thank you for your help, its very much appreciated.

    All thats left for me to do now is work on a few queries for the Spare Parts page - search by number, search by machine, search by description, search by supplier - I will be fine with all of those.

    Then those forms will need to be populated.

    After that? well, I may have a form for entering meter readings, but thats a long way off.

    Youve been most helpful.

    Rek

  13. #28
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Glad it's working.

    Review http://www.allenbrowne.com/ser-62.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.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 10-30-2014, 09:40 AM
  2. Replies: 5
    Last Post: 10-29-2014, 12:12 PM
  3. Report Based on Field Frequency
    By thegnome in forum Reports
    Replies: 1
    Last Post: 03-12-2013, 12:28 PM
  4. Replies: 9
    Last Post: 08-10-2012, 03:10 AM
  5. Generate reports by frequency
    By MFS in forum Programming
    Replies: 2
    Last Post: 11-18-2010, 08:09 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