Results 1 to 12 of 12
  1. #1
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145

    I need a Warning Popout Box!


    I have this Database that people can add more items within orders, such as if we need a part from our Fabrication Department. . . . .We have a Guy that enters it in but sometimes forgets to check whos name it goes under so it doesnt assign itself to that persons form.I want a Warning Popout that States this."You have failed to Assign this Part""Please Check One of the Boxes Please"And it has an OK button so that they can Go back and make the changes.The Check boxes have names corresponding to another Form for a specific person. Each check box assigns that order to that persons form.I have Attached some pictures the names are as follows.PabloRubenLeo
    Attached Thumbnails Attached Thumbnails 1.jpg   12.JPG   123.jpg   1234.JPG  

  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,772
    Can be only one checkbox selected? Suggest using radio buttons in an Option Group control. Or listbox or combobox.

    Is this checkbox value saved to a field?

    Why would you need a form for each person? Why not one form and apply filter criteria?
    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
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    I didnt set it up that way I am coming behind a guy that got fired to try and fix some of the mistakes.

    If you can see there are 4 check boxes but only 3 of them are used so I deleted the four which says Lenses.

    I need a warning box that pops up if none of them are checked.

  4. #4
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    I learned this from the board (June7Helped)

    Private Sub Action_Complete_Click()
    If Me![Field Name] & "" = "" Then
    [Checkbox Field Name] = False
    MsgBox "You forgot to fill it in dude!"
    Exit Sub
    End If
    End Sub

    Hope this helps some

  5. #5
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    I have made this Code.

    Code:
    If ListDanville = False Then
        MsgBox "You forgot to fill in Who!"
        End If
    If ListTeam1 = False Then
        MsgBox "You forgot to fill in Who!"
        End If
    If ListTeam2 = False Then
        MsgBox "You forgot to fill in Who!"
        End If
    And all it does is exit back to main form how can I get it to stay on the edit form???

  6. #6
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    Updated Code,
    But still get the part were it goes back to main form.

    this is code now

    Code:
    If ListDanville Or ListTeam1 Or ListTeam2 = False Then
        MsgBox "You forgot to fill in Who!"
        End If

  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,772
    Since you want to verify that at least one of the checkboxes is checked, the code should be:

    If ListDanville = False And ListTeam1 = False And ListTeam2 = False Then
    MsgBox "You forgot to fill in Who!"
    End If

    However, that won't prevent multiple checkboxes checked. That's why I suggested alternatives.

    Consider this:

    If IIf(ListDanville = False, 0, 1) + IIf(ListTeam1 = False, 0, 1) + IIf(ListTeam2 = False, 0, 1) <> 1 Then
    MsgBox "You either did not select Who or selected more than 1 - correct this!"
    End If

    Where did you put the code? Is it in the subform BeforeUpdate event?

    Sub Form_BeforeUpdate(Cancel As Boolean)
    If IIf(ListDanville = False, 0, 1) + IIf(ListTeam1 = False, 0, 1) + IIf(ListTeam2 = False, 0, 1) <> 1 Then
    MsgBox "You either did not select Who or selected more than 1 - correct this!"
    Cancel = True
    End If
    End Sub
    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
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    Okay what I think you are trying to accomplish is non Multiple boxes being checked... Thats not my Case.

    I want at least one box check when that form is left. . . .

    I want a warning for when none of the check boxes are checked. . .

    And when the warning opens it doesnt leave that form but goes back to edit the mistake.

  9. #9
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    On your section that has the checkboxes select them all in design view, in the TAG property put in "REQ" or something similar.

    On your button click you can then have something like:

    Code:
    dim ctl as control
    dim iTotAnswered as long
    
    for each ctl in me.controls 'this cycles through every control on the form, if you're using a tabbed form you can lock it down to a specific tab of the tab control
        if instr(ctl.tag, "REQ") > 0 then
            if ctl.value = -1 then
                iTotAnswered = iTotAnswered + 1
            endif
        endif
    next ctl
    
    if iTotAnswered = 0 then
        msgbox "HEY DUMMY FILL OUT A RESPONSIBLE PARTY", vbokonly, "DUMMY WARNING"
        exit sub
    endif
    
    'leave your other code here
    this way if you ever add/remove stations all you have to do is make sure the checkbox has it's TAG property set and you're good.

  10. #10
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    Well my current code works but i need to stay on the edit form so that he can make his changes.

    so is there a code to say dont close the form.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I want at least one box check when that form is left. . . .
    My code accomplishes that as well as prevent multiple selections. This could be incorporated into rpeare's more flexible code.
    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. #12
    Z1nkstar's Avatar
    Z1nkstar is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Location
    TX, USA
    Posts
    145
    Okay used rpeare's code and it worked.

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

Similar Threads

  1. Custom warning
    By janelgirl in forum Forms
    Replies: 4
    Last Post: 05-04-2011, 01:56 PM
  2. set warning off
    By bet in forum Programming
    Replies: 2
    Last Post: 03-27-2011, 04:21 PM
  3. security warning
    By wthoffman in forum Access
    Replies: 3
    Last Post: 02-26-2011, 09:22 AM
  4. Security Warning
    By mojo53777 in forum Security
    Replies: 0
    Last Post: 11-16-2007, 06:23 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