Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Required field entry (A2K SP3)

    I have frmCheckInLast that has a Close button with the following On Click event:

    If ((Me.DepositRefundAmt = 999 And Me.TrfTo > 0 And IsNull(Me.DepositTransferred) And IsNull(Me.TrfFrom)) Or _
    (IsNull(DepositRefundAmt) And IsNull(Me.TrfTo) And Me.DepositTransferred > 0 And Me.TrfFrom > 0) Or _
    (Me.DepositRefundAmt = 999 And IsNull(Me.TrfTo) And IsNull(DepositTransferred) And IsNull(TrfFrom)) Or _
    (IsNull(Me.DepositRefundAmt) And IsNull(Me.TrfFrom) And IsNull(Me.DepositTransferred) And IsNull(Me.TrfTo)) Or _
    (Me.DepositRefundAmt = 999 And Me.TrfTo > 0 And Me.DepositTransferred > 0 And Me.TrfFrom > 0) Or _
    Me.DepositRefundAmt < 0) Or (Me.DepositRefundAmt < 888 And IsNull(Me.TrfTo)) Then
    blnCanClose = True
    DoCmd.Close acForm, "frmCheckInLast"

    Else
    MsgBox "You must enter the receipt number to or from where the Deposit is being transferred and you can't enter a transferred from or to reciept number without a transferred amount field having been entered"

    End If
    End Sub

    I have a field on the form, RoomKeyDate, which is located in tblRental. It is a short date and is a required field with a Validation rule of Is Not Null with appropriate validation text.

    When the Close Form is clicked, the form closes without any warning message that the RoomKeyDate has been left blank.

    What is the best way to force the operator to enter a date in this field?

    Tom

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

    Re: Required field entry (A2K SP3)

    Check RoomKeyDate in the On Click event of the Close button, and don't set blnCanClose to True or close the form if RoomKeyDate is blank.

  3. #3
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Required field entry (A2K SP3)

    Thanks for pointing me in the right direction.

    My attempt at the new code is

    If (IsNull(Me.RoomKeyDate)) then
    MsgBox

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

    Re: Required field entry (A2K SP3)

    Something like

    If IsNull(Me.RoomKeyDate) Then
    MsgBox

  5. #5
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Required field entry (A2K SP3)

    Many thanks. I guess I just went brain dead.

    Tom

Posting Permissions

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