"Murray" <Murray[ at ]discussions.microsoft.com> wrote in message news:18340BC1-9B9F-4AC3-92A2-F8E99C120621[ at ]microsoft.com...
[Quoted Text] > Hi all, > I guess I am doing something wrong here and not really understanding what. > I have a bit of code that you look to seee if the field is empty and if > empty the assign it a string value.the code I am using is: > > DIM CS as Sting > If Me![contract subform]!CSO.Value = "" Then > CS = "no CSO" > Else > CS = Me![contract subform]!CSO.Value > End If > The CSO Value is the Customer Service Officer, so if they have not put a > name in then a temp value is assigned otherwise the CSO is assigned to the > value. > When I run the code and the CSO.Value field is empty the code stops in the > Else statement saying invalid use of NULL > Can someone point me in the right direction? > Thanks
If they haven't filled out the field then it is Null which is not the same as "". CS cannot be assigned a Null value because only variables of type Variant can be Null. Change to...
If IsNull(Me![contract subform]!CSO.Value) Then...
-- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com
|