Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Before Update

samoteksamotek Member Posts: 9

Io my main form i have a control called ChangePrice and on clkcing i set the focus to the control UnitPrice on the subform and enable the editing of the price.It cannot work because of the code in the BeforeUpdate event of the subform which is as follows:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Quantity) Then
MsgBox " You have to fill in either quantity or cartons!", vbCritical
Cancel = True
DoCmd.GoToControl "productid"
Exit Sub
End If
End Sub


Thus,when i click the control Changeprice on the main form i receive the message
" You have to fill in either quantity or cartons!", vbCritical,from the BeforeUpdate event.
Can i restrict the action of the Before update event when i click the control ChangePrice ?
for example
If Parent!CmdChangePrice = true Then
If IsNull(Me.Quantity) Then
MsgBox " You have to fill in either quantity or cartons!", vbCritical
Cancel = True
DoCmd.GoToControl "productid"
Exit Sub
End If
End If

I have tried it but without succes.Where i am wrong ?

==================================


I am trying to resolve it by putting a condition in the Before Update event:
If Not IsNull(Me.Parent.CmdChangePrice) And IsNull(Me.Quantity) Then
.....

But it doesn help.May be i have written it wrong














Sign In or Register to comment.