UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Comma Coming Thru When Nz, Any Version    
 
   
damian.green
post Feb 20 2020, 01:13 PM
Post#1



Posts: 171
Joined: 24-October 18



How would you change the below code to not show the commas if any of the below fields?

CODE
Location = Nz(Me.Location, "") & (", " + Nz(Me.Address, "")) & (", " + Nz(Me.City, "")) & (", " + Nz(Me.State, "")) & (", " + Nz(Me.ZIPCode, ""))
Go to the top of the page
 
cheekybuddha
post Feb 20 2020, 01:40 PM
Post#2


UtterAccess Moderator
Posts: 12,620
Joined: 6-December 03
From: Telegraph Hill


Search UA for 'The law of propagating Nulls'.

Try:
CODE
Location = Me.Location & vbNullString & (", " + Me.Address) & (", " + Me.City) & (", " + Me.State) & (", " + Me.ZIPCode)


hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
damian.green
post Feb 20 2020, 01:46 PM
Post#3



Posts: 171
Joined: 24-October 18



Perfect. Thanks.
Go to the top of the page
 
cheekybuddha
post Feb 20 2020, 01:49 PM
Post#4


UtterAccess Moderator
Posts: 12,620
Joined: 6-December 03
From: Telegraph Hill


Beware, you might get an initial comma if it's possible to have Me.Location = Null and a value in any of the other controls.

If so, the solution is a bit more complex.

thumbup.gif

--------------------


Regards,

David Marten
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    31st March 2020 - 05:09 PM