Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo box restrictions (Access 2000)

    Combo box forbdidding to choose another product

    In the BeforeUpdate event of the form i want to have a code that forbids the user to choose another product from the combo box if he has left the controls either quantity or cartons blank.
    My code worked with my previous databases but not with this one, because i am reprocessing the database.i have to confess that my database is built with the help of the present
    Forum.I am applying the attachment with my code in it.
    Of course this condition of forbidding cannot be applied with the first product being chosen, since it will not be possible then to make the invoice,
    but after that , with the next products,i want to forbid the user forgetting the fill in either the cartons or the quantity.What will be the right way to do it ?



    If IsNull(Me!Quantity) And IsNull(Me!cartons) And Me.Parent!customerid <> 123 Then
    MsgBox " you must eneter either cartons or quantity!", vbCritical
    Cancel = True
    DoCmd.GoToControl "productid"
    DoCmd.Beep
    DoCmd.Beep

    Exit Sub
    End If

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box restrictions (Access 2000)

    The default value of cartons is 0 (zero). So Cartons is never Null.
    Remove the default value 0 or change the If statement to :
    If IsNull(Me!Quantity) And Me!cartons=0 And Me.Parent!customerid <> 123 Then
    Francois

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo box restrictions (Access 2000)

    Yeas ! the database runs now. Thank you !!!

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

    Re: Combo box restrictions (Access 2000)

    Compare this to <post#=519,140>post 519,140</post: > where we discussed a similar issue.

Posting Permissions

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