Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Feb 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Validation Rule for table (Access 2000)

    Here is my problem. I have a table named Movies with following fields, MovieID, Title, On-hand,movie type ,length, director price and production company. I need to set a validation rule that does not allow me to invest more than $150 per title. The prices of each book are different values but cannot have more than $150 worth of stock on-hand per book. Any idea's? Thanks a bunch

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Validation Rule for table (Access 2000)

    Hi,
    If I understand you correctly, then you'll need to do the validation via your data-entry form (I'm assuming you're not entering data directly into the table as that's generally not a good idea)
    In the beforeupdate event of your form, you need some simple code like:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Me!txtOnHand * Me!txtDirectorPrice > 150 Then
    MsgBox "Cannot have more than $150 worth per movie"
    Cancel = True
    End If
    End Sub
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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