<<Any suggestions on how to fully qualify RSF as
Me!METRODCBUILDINGS!RSF>>
Er, am I missing something?
Me!METRODCBUILDINGS!RSF
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
Thanks so much for your help
A couple more questions.
Here is the code I have now:
Private Sub PRICE_PSF_AfterUpdate()
Me.PRICE_PSF = IIf(IsNull(SALE_PRICE) Or
IsNull(Me!METRODCBUILDINGS!RSF), "TBD", CCur(Nz([SALE_PRICE], 0) /
Nz(RSF, 0)))
End Sub
Any suggestions on how to fully qualify RSF as Me!METRODCBUILDINGS!RSF
?
Also, how do I set the textbox's BackStyle property to transparent if
the calculation returns "TBD"? I know where the field property is but
all it has is a pulldown menu for normal and transparent.
Sorry, I'm a newbie
Jeff
Graham R Seach wrote:
The problem is that (a) your field is a Currency datatype, which can't
contain a string value, and (b) the end of your calculation fails to
fully
qualify rsf as Me!metrodcbuildings!rsf.
As for resolving the datatype problem, you can place a label control
underneath (using Format | Send to Back) the textbox, set it's Caption
property = "TBD", and set the textbox's BackStyle property to
Transparent
if
the calculation returns "TBD", otherwise put the value into the
textbox,
and
set its BackStyle property = Normal.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
It is calculating correctly but still no "TBD."
Perhaps it is something else.
Could the problem be that the FORMAT for the field is set to
currency
but the DEFAULT VALUE is set to "TBD" ?
Jeff
Klatuu wrote:
I don't really see the problem, the syntax appears to be correct.
:
OK
Here is where I am so far:
Private Sub PRICE_PSF_AfterUpdate()
Me.PRICE_PSF = IIf(IsNull(SALE_PRICE) or
IsNull(Me!metrodcbuildings!rsf
),"TBD", CCur(Nz([sale
price], 0) / Nz(rsf, 0)))
End Sub
The default value is set to TBD and the FORMAT is set to
currency.
Jeff
Klatuu wrote:
yes, it does matter. You have to qualify the reference to
include
the
subform contorl on the main form, note, this is not the name of
the
subform,
but the name of the subform control.
Me!SubFormControlName!Field2
As to the compile error, my eyesight is not so good, so I can't
see
what you
did from here. Posting it would be very helpful
:
I'm still not there.
I am getting the following error message when I try to put in
the
code:
Compile Error:
Expected: List separator or )
Also, does it matter that field1 is in the main form and and
field2
is
in a subform with field3?
Jeff
Klatuu wrote:
I would make the Default Value property of Field3 "TBD"
I would put the code in a sub and call it from the After
Update
events of
Field1 and Field2.
:
Where should I insert this code?
Jeff
Klatuu wrote:
I believe your code will throw a divide by 0 error.
How about
Me.Field3 = IIf(IsNull(Field1) or IsNull(Field2),"TBD",
CCur(Nz([sale
price], 0) / Nz(rsf, 0)))
:
Jeff,
Me.Field3 = IIF(Nz([sale price], 0) / Nz(rsf, 0) = 0,
"TBD", CCur(Nz([sale
price], 0) / Nz(rsf, 0)))
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
message
I have a form that performs a simple calculation.
It divides field1 (SALE PRICE) by field2 (RSF) to
give
me
field3,
(PRICE PSF)
BUT, sometimes, when entering data, I do not know
one
or
both of the
first two fields and leave them blank. When that is
the
case, Access
places either "#NUM!" or "$0" in the field. How do
I
change the
preferences to read "TBD" in field 3 when either
field1
or field2 are
empty?
Jeff