Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010
    Posts
    1

    Unanswered: Automatically Populating based on other cell in a form setup

    Hey guys. New to the forum, I tried searching but I couldn't find what I was exactly looking for. What I'm trying to do doesn't appear to be very difficult but I simply can't figure it out.

    I have a form with several multivalued checkboxes and folowing that I have yes/no text box dropdowns. This is a sample situation of something that I'm trying to make happen.

    Bowling Equipment: [] None, [] Shoes, [] Ball
    Payment Required: Yes, No

    If the person checks None I want the payment required field below it to automatically fill with the No option. But if they check either Shoes or Ball or even both options, I want the payment required field to automatically say Yes.

    Currently I have a lot of fields to fill out and if I can have one field make its own decision based on what I input once, it will make my job much easier.

    I think that's clear, if it's not please let me know how I can reword my post.

    Thanks a lot!

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    a) Three independant check boxes: Check_Ball, Check_None, Check_Shoes
    b) One option group frame: Frame_Payment, with two option buttons: Option_No (Option value=0) and Option_Yes (Option value = -1)
    c) Code:
    Code:
    Option Compare Database
    Option Explicit
    
    Private Sub Check_Ball_AfterUpdate()
    
        Me.Check_None.Value = Not (Me.Check_Ball.Value Or Me.Check_Shoes.Value)
        Me.Frame_Payment.Value = Not Me.Check_None.Value
        
    End Sub
    
    Private Sub Check_None_AfterUpdate()
    
        Me.Check_Ball.Value = False
        Me.Check_Shoes.Value = False
        Me.Frame_Payment.Value = False
    
    End Sub
    
    Private Sub Check_None_BeforeUpdate(Cancel As Integer)
    
        Cancel = Not Me.Check_None.Value
        
    End Sub
    
    Private Sub Check_Shoes_AfterUpdate()
    
        Me.Check_None.Value = Not (Me.Check_Ball.Value Or Me.Check_Shoes.Value)
        Me.Frame_Payment.Value = Not Me.Check_None.Value
    
    End Sub
    
    Private Sub Frame_Payment_AfterUpdate()
    
        If Me.Frame_Payment.Value = False Then
            Me.Check_None.Value = True
            Me.Check_Ball.Value = False
            Me.Check_Shoes.Value = False
        Else
            Me.Frame_Payment.Value = Me.Check_Ball.Value Or Me.Check_Shoes.Value
        End If
        
    End Sub
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •