• Is Null (Access 2000)

    Author
    Topic
    #439131

    In the before update event of the subform I want the message
    ” You must enter either cartons or quantity.Cancel? ” to appear only when the control TglUnitptice is not pressed.
    I cannot solve this conflict.My before update event is the following :
    If IsNull(Me!Quantity) Then
    If MsgBox(” You must enter either cartons or quantity.Cancel? “, _
    vbYesNo + vbQuestion) = vbYes Then
    DoCmd.GoToControl “productid”
    Me.ProductID.SetFocus
    Else
    Me.Undo
    Cancel = True
    Exit Sub
    End If
    End If
    I wanted to add Or IsNull(Parent!TglUnitPrice), but this has no effect.
    I want to keep the before update event and also to able to use the button

    Viewing 0 reply threads
    Author
    Replies
    • #1048661

      A command button doesn’t have a value, so IsNull(Parent!TglUnitPrice) makes no sense.

      Why not remove the command button? It doesn’t serve any useful purpose as far as I can see.

      • #1048662

        This command button is very important to me, only i cannot explain it well, since the importance is lost in cutting off the real database.The function of this button is the following. After i choose a product, then the control appears and if i want to change the price, on clicking the button i go to the control untiprice and there i can manually enter another price, not the price that is calculated automatically.However i cannot go to this control since the message appears due to the before update event in the subform.This before update event is also important to me.Please help me solve this problem.

        • #1048663

          Sorry, it makes no sense to select a product on the subform, then click on a button on the main form to go to a control to the subform. It’s much easier to click in the UnitPrice directly.

          • #1048696

            Clicking on the unitprice itself is not possible because of the befor eUpdate event. It is true, i can write the new price in it, but then i cannot update it, i am given this warning message from the BeforeUpdate event and i am thrown out of the line.And also, i didnt mention it to you, but i have locked the control Unitprice so the user should not change the price unless he uses the control on the main form, and in the Onclick event of TglUnitPrice i am unlocking the unit ptice too.I cannot suggest myself any way out of it, i can only describe to you in full detail what we are doing and what i want is to get it working.So i will be grateful for any advice, i could also change the whole approach only to get it working. Thank you in advance
            kind regards
            solar

            • #1048699

              I would change the subform to a continuous form instead of a datasheet form. You can then place a button either in the detail section of the subform, or in the form header of the subform. Because the button is on the subform itself, clicking it will not cause the Before Update event of the form to fire.

            • #1048703

              Thank you for your interesting suggestion. I will definitely process it in the future because it has many advantages.For the time being i am having troubles with the design. Is it possible to call the before update event in the subform in a datasheet view, only if the control button TglUnitprice is not pressed ? I mean to set an If clause in the before update event ? If you answer me that it is not possile, then i will have to reconsdier my whole design

              kind regards

              solar

            • #1048704

              As soon as you click outside the subform, Access tries to save the current record in the subform, and hence the Before Update event fires. That’s why I suggested using a button on the subform itself.

    Viewing 0 reply threads
    Reply To: Is Null (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: