Auto-fill and Required Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sam the lion
    New Member
    • Feb 2008
    • 2

    Auto-fill and Required Field

    Hi,

    I'm currently running Access 2007 on Windows XP Professional. I'm a novice for the most part, and this is my first database. I'm having difficulty figuring out how to do the following:

    1. I'm currently setting up a form for the UI. I need to have a Yes/No field set-up so, when checked it auto-fills the date in separate field. I have the fields created, but I do not know how to implement that 'action'.

    2. On the same form I have a lookup field. I need to have one of the entries on the drop-down to require an entry on another field. For example: If the look-up field is 'Ice Cream Flavors', and the drop-down option is 'Chocolate', the required field would be 'Milk Chocolate or Dark?'

    Please note I have no programming knowledge. Thanks!
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    QUESTION 1:

    Place this code in the AfterUpdate event of the checkbox.
    Code:
     Private Sub DaterCheckBox_AfterUpdate()
     If DaterCheckBox Then
       Me.MyDateTextBox = Date
     Else
       Me.MyDateTextBox = ""
    End If
    End Sub
    QUESTION 2:

    We need some more information here! What exactly do you want to happen if 'Chocolate' is selected? Do you want the field for 'Milk Chocolate or Dark' to appear, where it was invisible before? Do you want it to start out being disabled (grayed out) then become enabled? Or do you simply want to check before the record is saved to insure that a choice has been made?

    Welcome to TheScripts!

    Linq ;0)>

    Comment

    • sam the lion
      New Member
      • Feb 2008
      • 2

      #3
      Originally posted by missinglinq
      QUESTION 1:

      Place this code in the AfterUpdate event of the checkbox.
      Code:
       Private Sub DaterCheckBox_AfterUpdate()
       If DaterCheckBox Then
         Me.MyDateTextBox = Date
       Else
         Me.MyDateTextBox = ""
      End If
      End Sub
      QUESTION 2:

      We need some more information here! What exactly do you want to happen if 'Chocolate' is selected? Do you want the field for 'Milk Chocolate or Dark' to appear, where it was invisible before? Do you want it to start out being disabled (grayed out) then become enabled? Or do you simply want to check before the record is saved to insure that a choice has been made?

      Welcome to TheScripts!

      Linq ;0)>
      Thanks!


      "Do you want it to start out being disabled (grayed out) then become enabled?"

      Yes, the 'Milk or Dark' field is already on the form and should be, so ideally I would like it to be disabled unless 'Chocolate' is selected.

      Comment

      Working...