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

    Command to clear all ? (Access 2000)

    RunTime error 3314


    Is there a way to clear all the events and close the form after the command Cancelevent?


    I have a form orders and a subform Suborders. In the main form i selct the customer and in the subofmr i select the products
    Hoever the unit price for each product is defined with a lookup function according to the category of the client.

    I have a select case statement foir the categories and at the end with the Case else i define what will happen when
    no category is selectd.
    Case Else
    MsgBox " the client is not categorized"
    DoCmd.CancelEvent
    DoCmd.Close acForm, "FOrderinformation", acSaveNo
    DoCmd.OpenForm "FOrderinformation"
    End Select


    The code works fine, but after pressing ok on the dialog box the following problem appears.I get an error message
    because my field unjt price is set to the Required property:

    RunTime error 3314 : the field orderdetails.unitprice cannot contain a null value because the Required Property for this field is set to True.
    Enter a value in this field. On pressing the End, my dtaabse blocks and i receive numerous messages that the order cannot be saved and at last i receive the

    message that a fatal error has occured with Access. hIs it possible just to evade all this and to close the form without saving the record?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Command to clear all ? (Access 2000)

    Where is this code (in what subroutine) and why are you trying to use CancelEvent in the first place? Some form events can be canceled if they have a Cancel argument. Those that don't, can't be cancelled so you program them differently. It sounds like what you need is a Me.Undo to rollback the record.
    Charlotte

Posting Permissions

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