text box to display only if value is "1"

J

JohnLute

I have a text box and want it to display only if the [Layer] value is "1".

="(Food Contact) "+IIf(IsNull([Layer]),Null,"")

Any help with this would be greatly appreciated!

Thanks!
 
D

Duane Hookom

John,
Get up-to-speed on basic expressions and there syntax.

If Layer is a text field, try:
="(Food Contact) "+IIf([Layer]="1",Null,"")

If Layer is a numeric field, try:
="(Food Contact) "+IIf([Layer]=1,Null,"")
 
O

Ofer

On the On format property of the section where the text field is, you can
write the code

Me.TextFieldName.visible=(nz(me.[layer],"0")="1")
 
J

JohnLute

I'm doing my best to get up to speed, however, my transmission is a bit worn!

I tried the two options you listed but get an odd return. The text box does
NOT appear for the record with the value "1" rather, it appears for all other
records!

???

--
www.Marzetti.com


Duane Hookom said:
John,
Get up-to-speed on basic expressions and there syntax.

If Layer is a text field, try:
="(Food Contact) "+IIf([Layer]="1",Null,"")

If Layer is a numeric field, try:
="(Food Contact) "+IIf([Layer]=1,Null,"")

--
Duane Hookom
MS Access MVP
--

JohnLute said:
I have a text box and want it to display only if the [Layer] value is "1".

="(Food Contact) "+IIf(IsNull([Layer]),Null,"")

Any help with this would be greatly appreciated!

Thanks!
 
J

JohnLute

Thanks, Ofer.

I gave this a whirl but it returns "can't find macro." I prefer Duane's
suggestion as it follows the format I've already mapped out. However, it
doesn't seem to be working, either!

--
www.Marzetti.com


Ofer said:
On the On format property of the section where the text field is, you can
write the code

Me.TextFieldName.visible=(nz(me.[layer],"0")="1")



JohnLute said:
I have a text box and want it to display only if the [Layer] value is "1".

="(Food Contact) "+IIf(IsNull([Layer]),Null,"")

Any help with this would be greatly appreciated!

Thanks!
 
D

Duane Hookom

You should be able to look at my provided expression and easily determine my
mistake. Also, I made reference to the data type of [Layer] and you didn't
provide this information.

Try:

If Layer is a text field, try:
="(Food Contact) "+IIf([Layer]<>"1",Null,"")

If Layer is a numeric field, try:
="(Food Contact) "+IIf([Layer]<>1,Null,"")

--
Duane Hookom
MS Access MVP
--

JohnLute said:
I'm doing my best to get up to speed, however, my transmission is a bit
worn!

I tried the two options you listed but get an odd return. The text box
does
NOT appear for the record with the value "1" rather, it appears for all
other
records!

???

--
www.Marzetti.com


Duane Hookom said:
John,
Get up-to-speed on basic expressions and there syntax.

If Layer is a text field, try:
="(Food Contact) "+IIf([Layer]="1",Null,"")

If Layer is a numeric field, try:
="(Food Contact) "+IIf([Layer]=1,Null,"")

--
Duane Hookom
MS Access MVP
--

JohnLute said:
I have a text box and want it to display only if the [Layer] value is
"1".

="(Food Contact) "+IIf(IsNull([Layer]),Null,"")

Any help with this would be greatly appreciated!

Thanks!
 
O

Ofer

You need to enter this code in the code section, when you in the On format
property, click on the button with the three dots, select code, and enter the
line

JohnLute said:
Thanks, Ofer.

I gave this a whirl but it returns "can't find macro." I prefer Duane's
suggestion as it follows the format I've already mapped out. However, it
doesn't seem to be working, either!

--
www.Marzetti.com


Ofer said:
On the On format property of the section where the text field is, you can
write the code

Me.TextFieldName.visible=(nz(me.[layer],"0")="1")



JohnLute said:
I have a text box and want it to display only if the [Layer] value is "1".

="(Food Contact) "+IIf(IsNull([Layer]),Null,"")

Any help with this would be greatly appreciated!

Thanks!
 
J

JohnLute

BINGO!

Thanks! One day I may see mistakes by MVP's but for now I'm just a
"grasshopper."

BTW: it's a txt field. Sorry I didn't make that clear before.

--
www.Marzetti.com


Duane Hookom said:
You should be able to look at my provided expression and easily determine my
mistake. Also, I made reference to the data type of [Layer] and you didn't
provide this information.

Try:

If Layer is a text field, try:
="(Food Contact) "+IIf([Layer]<>"1",Null,"")

If Layer is a numeric field, try:
="(Food Contact) "+IIf([Layer]<>1,Null,"")

--
Duane Hookom
MS Access MVP
--

JohnLute said:
I'm doing my best to get up to speed, however, my transmission is a bit
worn!

I tried the two options you listed but get an odd return. The text box
does
NOT appear for the record with the value "1" rather, it appears for all
other
records!

???

--
www.Marzetti.com


Duane Hookom said:
John,
Get up-to-speed on basic expressions and there syntax.

If Layer is a text field, try:
="(Food Contact) "+IIf([Layer]="1",Null,"")

If Layer is a numeric field, try:
="(Food Contact) "+IIf([Layer]=1,Null,"")

--
Duane Hookom
MS Access MVP
--

I have a text box and want it to display only if the [Layer] value is
"1".

="(Food Contact) "+IIf(IsNull([Layer]),Null,"")

Any help with this would be greatly appreciated!

Thanks!
 
Top