expression that has no value

G

geebee

hi,

i am getting an "youve entered an expression that has no value" message,
pointing to the following:

If IsNull(Nz(Forms!frm_charity.Form!sbfrm_template!ttl_1704.Value, 0)) Then
Me.Frame259 = Null
Else
Me.Frame259 = 1
End If


i would like to know how i can prevent this. the form is set up to where it
has no recordsource, and although the subform has a recordsource, the
allowadditions property is set to NO.

thanks in advance,
geebee
 
D

dymondjack

I believe you need to change the syntax regarding "." and "!"

IsNull(Nz(Forms!frm_charity.Controls!sbfrm_template.Form.ttl_1704.Value, 0))



--
Jack Leach
www.tristatemachine.com

- "A designer knows he has reached perfection not when there is nothing left
to add, but when there is nothing left to take away." - Antoine De Saint
Exupery
 
G

geebee

i tried that but it doesnt work. the funny thing is if i hit debog and then
stop the debugger, then select another value from the dropdown, i dont get
that error message. only happens the first time a value is selected from the
dropdown after the form is opened.
 
D

dymondjack

I am not sure... I posted the previous line of code because it came from a
recordsource setting that I use in a search form and knew that the expression
would point to the subform property.

I am wondering about the IsNull(Nz(...)) statement though. Generally you
see one or the other, I've never seen them both used like this. I would
assume that IsNull would never return true, because it wraps the Nz function,
which will not return Null. What this may have to do with your expression
only working on the second time around, I do not know, but maybe you could
play around with that (try removing the Nz)

Aside from that, I don't know. Maybe try checking the controls .Text
property rather than .Value?


--
Jack Leach
www.tristatemachine.com

- "A designer knows he has reached perfection not when there is nothing left
to add, but when there is nothing left to take away." - Antoine De Saint
Exupery
 
D

Douglas J. Steele

First of all, it makes no sense whatsoever to use the IsNull function on a
value to which you've applied the Nz function! Nz converts null values to a
known value (0 in this case), so IsNull will never be true.

Second, the usage of .Controls is incorrect.

IsNull(Forms!frm_charity!sbfrm_template.Form!ttl_1704.Value)

or

IsNull(Forms!frm_charity.Controls("sbfrm_template").Form!ttl_1704.Value)

One thing to be careful of is that you're referring to the subform control.
Depending on how you added the form as a subform, the name of the subform
control may not be the same as the name of the form being used as a subform.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top