none
Need Help with Expression code For Computer Aided Dispatch Officer Safety Check ! RRS feed

  • Question

  • I am continuing working on this Computer Aided Dispatch (CAD) program and I cannot figure something out.

    I have a safety check ( Option Box- but I am willing to use a checkbox) that when an officer checks out on

    a call and the dispatcher needs a warning to check on him after 5 minutes it will flash a msg " Officer Safety Check".

    When the option box is blank or checkbox NOT CHECKED then it will send the msg after 5 minutes, but when it is checked

    then the message will not be displayed as he might be on a call or check out event in which the dispatcher does not need

    to check on him.

    I have created a macro called safetycheck which does display the message after the 5 minutes but it always displays it

    after 5 minutes whether the box is checked or not because I don't know how to code it conditionally so that if it is checked it will not display message.

    Can someone please help with this and tell me what the expression code is or how to do this ?

    It would be greatly appreciated !

    borderchildren

    Tuesday, April 18, 2017 1:05 AM

Answers

  • Hello,

    You could use the following code to check if the checkbox is selected.

    Private Sub Form_Timer()
    'checked -1
    'uncheck 0
    If Me.Check23.Value = 0 Then
    'DoCmd.RunMacro "safetycheck"
    MsgBox "NO"
    End If
    End Sub
    

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by borderchildren Wednesday, April 19, 2017 6:10 PM
    Wednesday, April 19, 2017 3:55 AM
    Moderator

All replies

  • Hello,

    How do you call the macro to display the message box now?

    I would suggest you handle Form On Timer event to check the statues of the checkbox every interval.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 18, 2017 6:05 AM
    Moderator
  • Hi Celeste,

    Thanks for your response

    Here is my code:

    Private Sub Form_Timer()
    DoCmd.RunMacro "safetycheck"
    End Sub

    I don't know what other code to use or how to word it so that it

    checks the checkbox status and if it is empty then do the 5 min

    timer and if it is checked then don't.  I am not much of a code builder

    and every time I try something, I get an expression error.

    I know it  has to be something like if box is false then etc... but don't know

    what to put in.  Help?

    borderchildren

    Tuesday, April 18, 2017 12:05 PM
  • Hello,

    You could use the following code to check if the checkbox is selected.

    Private Sub Form_Timer()
    'checked -1
    'uncheck 0
    If Me.Check23.Value = 0 Then
    'DoCmd.RunMacro "safetycheck"
    MsgBox "NO"
    End If
    End Sub
    

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by borderchildren Wednesday, April 19, 2017 6:10 PM
    Wednesday, April 19, 2017 3:55 AM
    Moderator
  • Thank You Celeste !

    The code you sent worked !

    Your a genius . 

    Regards

    borderchildren

    Wednesday, April 19, 2017 6:11 PM