No Slash IF Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using Access 97 and have a TextBox in a report which has the following as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report if
either the Equipment Nomenclature or the Equipment Name controls are NULL. I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete
 
Why not add an if statement to your report to pull this data....

Iif([SomeTextBox]=" / ","",[SomeTextBox])


Rick B
 
Use the + concatenation operator instead of the &. Unfortunately, if you
just replace both apersands with plusses, if either field is NULL, NOTHING
will show, so I'd try this:

ControlSource =Trim([Equipment Nomenclature]&" " + "/" + & " " [Equipment
Name])

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Roger - When I use your below suggestion I get "The expression you entered
contains invalid syntax."

Any ideas???? - Pete

Roger Carlson said:
Use the + concatenation operator instead of the &. Unfortunately, if you
just replace both apersands with plusses, if either field is NULL, NOTHING
will show, so I'd try this:

ControlSource =Trim([Equipment Nomenclature]&" " + "/" + & " " [Equipment
Name])

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Pete Sperling said:
I'm using Access 97 and have a TextBox in a report which has the following as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report if
either the Equipment Nomenclature or the Equipment Name controls are NULL. I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete
 
Whups. Got them switched:

ControlSource =Trim([Equipment Nomenclature] & " " + "/" + " " & [Equipment
Name])

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

Pete Sperling said:
Roger - When I use your below suggestion I get "The expression you entered
contains invalid syntax."

Any ideas???? - Pete

Roger Carlson said:
Use the + concatenation operator instead of the &. Unfortunately, if you
just replace both apersands with plusses, if either field is NULL, NOTHING
will show, so I'd try this:

ControlSource =Trim([Equipment Nomenclature]&" " + "/" + & " " [Equipment
Name])

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


I'm using Access 97 and have a TextBox in a report which has the
following
as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the
report
if
either the Equipment Nomenclature or the Equipment Name controls are
NULL.
I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete
 
Rick - Exactly where would I add your suggested if statement?? When I tried
to enter it as the ControlSource in the TextBox I had I got a Syntax Error
when I tried to open the report??
Again - Any help appreciated - Pete

Rick B said:
Why not add an if statement to your report to pull this data....

Iif([SomeTextBox]=" / ","",[SomeTextBox])


Rick B



Pete Sperling said:
I'm using Access 97 and have a TextBox in a report which has the following as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report if
either the Equipment Nomenclature or the Equipment Name controls are NULL. I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete
 
Roger - OK, no more Invalid Syntax, but I still get a "/" before Equipment
Name when Equipment Nomenclature is NULL. I don't want the "/" if either the
Equipment Nomenclature or the Equipment Name is null.

Any more suggestions - and thanks for your help in advance - Pete

Roger Carlson said:
Whups. Got them switched:

ControlSource =Trim([Equipment Nomenclature] & " " + "/" + " " & [Equipment
Name])

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

Pete Sperling said:
Roger - When I use your below suggestion I get "The expression you entered
contains invalid syntax."

Any ideas???? - Pete

Roger Carlson said:
Use the + concatenation operator instead of the &. Unfortunately, if you
just replace both apersands with plusses, if either field is NULL, NOTHING
will show, so I'd try this:

ControlSource =Trim([Equipment Nomenclature]&" " + "/" + & " " [Equipment
Name])

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


I'm using Access 97 and have a TextBox in a report which has the following
as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report
if
either the Equipment Nomenclature or the Equipment Name controls are NULL.
I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete
 
Roger - OK, no more Invalid Syntax, but I still get a "/" before
Equipment
Name when Equipment Nomenclature is NULL. I don't want the "/" if either
the
Equipment Nomenclature or the Equipment Name is null.

Make the Control Source: =Iif(IsNull([Equipment Nomenclature]) or
IsNull([Equipment Name]), Trim([Equipment Nomenclature]&" "&[Equipment
Name]), [Equipment Nomenclature]&" / "&[Equipment Name])

Tom Lake
 
I'm using Access 97 and have a TextBox in a report which has the following as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report if
either the Equipment Nomenclature or the Equipment Name controls are NULL. I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete

This works for me:

=([Equipment Nomenclature] + " / "+ [Equipment Name])
 
You're right! It would. That was my first thought, but I started second
guessing myself. Should have tested it. <sigh>

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

fredg said:
I'm using Access 97 and have a TextBox in a report which has the following as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report if
either the Equipment Nomenclature or the Equipment Name controls are NULL. I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete

This works for me:

=([Equipment Nomenclature] + " / "+ [Equipment Name])
 
I'm using Access 97 and have a TextBox in a report which has the following as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report if
either the Equipment Nomenclature or the Equipment Name controls are NULL. I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete
fredg said:
This works for me:

=([Equipment Nomenclature] + " / "+ [Equipment Name])


I don't see it Fred. The way I understand it, if either one
is Null, the result will be Null.

I was thinking of something along these lines:

=[Equipment Nomenclature] & IIf(([Equipment Nomenclature] +
[Equipment Name]) Is Null, "", " / ") & [Equipment Name]
 
I'm using Access 97 and have a TextBox in a report which has the following as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report if
either the Equipment Nomenclature or the Equipment Name controls are NULL. I
only want the "/" to appear if both controls are not NULL.

Any help appreaciated - Pete
fredg said:
This works for me:

=([Equipment Nomenclature] + " / "+ [Equipment Name])

I don't see it Fred. The way I understand it, if either one
is Null, the result will be Null.

I was thinking of something along these lines:

=[Equipment Nomenclature] & IIf(([Equipment Nomenclature] +
[Equipment Name]) Is Null, "", " / ") & [Equipment Name]

Marsh,
Well, now you've got me wondering what he meant.
My take was that he didn't want anything if EITHER of the fields was
null.
 
I'm using Access 97 and have a TextBox in a report which has the following as
its ControlSource =[Equipment Nomenclature]&" / "&[Equipment Name].

Is there someway that I can prevent the "/" from appearing in the report if
either the Equipment Nomenclature or the Equipment Name controls are NULL. I
only want the "/" to appear if both controls are not NULL.
fredg said:
This works for me:
=([Equipment Nomenclature] + " / "+ [Equipment Name])
Marshall said:
I don't see it Fred. The way I understand it, if either one
is Null, the result will be Null.

I was thinking of something along these lines:
=[Equipment Nomenclature] & IIf(([Equipment Nomenclature] +
[Equipment Name]) Is Null, "", " / ") & [Equipment Name]
fredg said:
Well, now you've got me wondering what he meant.
My take was that he didn't want anything if EITHER of the fields was
null.

Ok, Fred, that's what your expression does, but that's not
the way I read Pete's last sentence above ;-)
 
Tom - Thanks - It works perfectly. How do you guys learn this stuff??? I
have no background in writing this stuff. Again thanks - Pete

Tom Lake said:
Roger - OK, no more Invalid Syntax, but I still get a "/" before
Equipment
Name when Equipment Nomenclature is NULL. I don't want the "/" if either
the
Equipment Nomenclature or the Equipment Name is null.

Make the Control Source: =Iif(IsNull([Equipment Nomenclature]) or
IsNull([Equipment Name]), Trim([Equipment Nomenclature]&" "&[Equipment
Name]), [Equipment Nomenclature]&" / "&[Equipment Name])

Tom Lake
 
Back
Top