Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is Null (Access 2000)

    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
    Attached Files Attached Files

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

    Re: Is Null (Access 2000)

    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.

  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is Null (Access 2000)

    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.

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

    Re: Is Null (Access 2000)

    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.

  5. #5
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is Null (Access 2000)

    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

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

    Re: Is Null (Access 2000)

    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.

  7. #7
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is Null (Access 2000)

    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

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

    Re: Is Null (Access 2000)

    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.

Posting Permissions

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