Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Requiring data in a Form (Access 2000)

    I have a combo box bound to a control that does not require data. However, I want that to change dynamically, based on other entries in the form. If the user enters a date in another control, then I want to make selecting from the combo box mandatory.

    TIA

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Requiring data in a Form (Access 2000)

    Hi 3cats,

    You can test in the BeforeUpdate event if the form. Let's say that the text box is named txtDate and the combo box is named cbxToCheck.

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    ' Test whether date hase been entered while combo box is empty.
    If Not IsNull(Me.txtDate) And IsNull(Me.cbxToCheck) Then
    ' Inform user.
    MsgBox "You must select an item.", vbInformation
    ' Set focus to combo box.
    Me.cbxToCheck.SetFocus
    ' Prevent record from being saved.
    Cancel = True
    End If
    End Sub

  3. #3
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Requiring data in a Form (Access 2000)

    Thanks - that was a different approach than what I was thinking of (input mask, looking for a required control somewhere), but effective!

Posting Permissions

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