944,005 Members | Top Members by Rank

Dec 12th, 2008
0

Microsoft Access - removing spaces and dashes...

Expand Post »
I do apologise if this thread has been started in the wrong section. - Wasn’t sure where to put it...
________________________________________________________________

I am using Microsoft Access with a select query to combine 4 separate fields into 1 field for each record using the following expression:..

Expr1: ([prod_group_name] & " - " & [model] & " - " & [size] & " - " & [amps])

This part works fine, and gives me an output that looks something like this:..

"Amazon low voltage submersible pumps - Amazon 12v - 4.5"

Now some records have empty fields, and in which case nothing is shown. I.E. "RS sub pumps" have no size or amperage, so it comes out like this...

"RS submersible pumps - RS-150 - -" - (with the prevailing dashes and spaces which are not needed.)

So basically what I want to do is make it automatically put the spaces and dashes in ONLY if they are needed... Is this actually possible in Access? And if so, how could my expression be modified to do so?

Thanks for your time, any help greatly appreciated...

NuGG
Reputation Points: 10
Solved Threads: 1
Junior Poster
NuGG is offline Offline
110 posts
since Feb 2005
Dec 12th, 2008
0

Re: Microsoft Access - removing spaces and dashes...

Hi,

Use the inbuilt function nz
Expr1: (nz([prod_group_name],"") & " - " & nz([model],"") ....
Reputation Points: 13
Solved Threads: 29
Junior Poster
kb.net is offline Offline
169 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Windows Software Forum Timeline: Eror Unable to update system registry
Next Thread in Windows Software Forum Timeline: Viewer for DjVu and PDF





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC