Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing spaces

Status
Not open for further replies.

gronsky

Technical User
Feb 8, 2002
36
US
Afternoon,

REF: Microsoft Access

Okay, text box "gpl" has in it's Control Source the following;

=[Field 1]&" "&[Field 2]&" "&[Field 3]&" "&[Field 4]...etc

Table records are:
Field 1 Field 2 Field 3 Field 4 Field 5 Field 6
Big red juicy apple

Problem:
How do I get "gpl" to display;
Big red juicy apple

and not

Big red juicy apple
^ ^
(an unwanted space if the field is emply)

Any help is greatly appreciated!

Thanks
 
try this:

Code:
strText = ""
for counter = 1 to 6
  If not ["Field " & counter] = "" then
    strText = strText & " " & ["Field " & counter]
  end if
next counter

syntax may not be correct, but that's the idea i believe =)

--llam
 
modify your control sourcce;

=trim([Field 1])&" "&trim([Field 2])&" "&trim([Field 3])&" "&trim([Field 4])...etc

 
Thanks for your help, but shortly after posting my problem I found a solution.

If
Field 4.Text = ""
then
Field 4.Visible = False
End if

Used in the Format of the column in the table.

But again, thanks for the replies and offerings.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top