#type in subform

Lynx2x

Registered User.
Local time
Today, 07:16
Joined
Jun 11, 2013
Messages
21
Hello!

I have a form which has subform with 5 fields. One of them is calculated like this: =DateAdd("m";[SolanjeVeljavnost];[Opravil]).

Everything is working fine when you enter data and it is calculating like it should, but what bothers me is than one row below in this calculated field ther is #type written. How do I get rid of this?

If anyone could tell me I would be very happy.
Thank you all in advance.:)
 
Hi
I assume the two fields in the function are within the subform and that the #type appears in the last (empty) record?
If you put a test (IIf function) within the calculated field to make sure at least one of the fields is not null, that may fix the problem. For example
Code:
=IIf(Nz(Opravil,0)=0,"",DateAdd("m";[SolanjeVeljavnost];[Opravil]))
I haven't tested this syntax, so you may need to modify it in Expression Builder in order to get the result you want, but it should give you some ideas.
If this doesn't address your problem, then please provide more details of context.
 
Hi!

Thanks for the reply and yes, two fields in the function are within the subform and that the #type appears in the last (empty) record.

I've tried with test (iif function), but it doesn't working properly.

To explain a little bit more: Field 1 is date, that shows when user completed some test, Field 2 is number which indicates how long test is valid. Now Field 3 is calculated field that shows date, when test expires. So, calculated field is full only if filed 1 and filed 2 is full.

So I've tried something like this
Code:
=IIf([SolanjeVeljaDo]<>"0" And [Opravil]<>"0";DateAdd("m";[SolanjeVeljavnost];[Opravil]);0)

But it is not working properly. It gives me date 30.12.1899 :banghead:

Any thoughts?
 
In the empty record, the field values are probably null, unless you explicitly populate them with zero in the table design.
The test
IIf([SolanjeVeljaDo]<>"0"
will always be true for a null field, so try it with the Nz function to assigne 0 when null.
 
Instead of 0, try a Null String.. As CDate(0) is 30/12/1899..
Code:
=IIf([SolanjeVeljaDo][B][COLOR=Red]<>"0"[/COLOR][/B] And [Opravil][COLOR=Red][B]<>"0"[/B][/COLOR];DateAdd("m";[SolanjeVeljavnost];[Opravil]);[COLOR=Blue][B]""[/B][/COLOR])
You might need to change the conditions for testing..
 
First of all thanks for all the help and replies.

I've managed to handle the problem and now in the empty field there is no #type.

Maybe someone else will find this helpful so here is the code:

Code:
=IIf(IsNull([Opravil]);"";DateAdd("m";[SolanjeVeljavnost];[Opravil]))

Thanks again and have a nice afternoon. :)
 

Users who are viewing this thread

Back
Top Bottom