Re: Expression not working



At Form_BeforeInsert, I think the Value of RC will be Null and I guess
that'ws why the expression won't work.

In the Form_BeforeInsert Event, add the following code:

Debug.Print Me.RC
Debug.Print IsNull(Me.RC)

and check the Immediate window to see what is printed.

--
HTH
Van T. Dinh
MVP (Access)




"Bassel" <Bassel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:56626147-613E-44C6-B9B4-FE57526A139C@xxxxxxxxxxxxxxxx
> Hello
> I have the following expression
> Me.ID = Nz(DMax("RcId", "StockInventorylog", "RC ='" & Me.RC & "'"), 0) +
> 1
> It's purpose is to add 1 to the ID for each RC value.
> When I put this expression in the Before Update event of another field in
> form it works.
>
> When i put this expression in the before insert event of the form , it
> doesn't work. except for the first time. ie for Id 1 only.
>
> Please can you help me solve this problem
>
> --
> Bassel


.