I'm extracting data from a database to create a table.
My table includes a text field 'Postcode' for postcodes.
Sometimes the extracted postcodes are in the format SL37HY and in other
instances a gap has been left somewhere in the data e.g. S L37HY or
SL3 7HY.
I want to validate the postcodes by matching them to a master table which
contains postcodes in the format SL37HY i.e. no spaces.
So......any advice....I need a simple way to edit my table and remove spaces from entries in the field 'Postcode' ??
Thanks in advance
3 4800
Hi John
I would normally use an array of characters, basic idea being:- - Loop thru the array looking for space character
- If found, save the array index where the space was found
- loop thru the remaining elements, moving them up one index
- Starting at the index you saved, loop thru the array looking for space character
- Go to 2
Of course you could also use a string and the Mid function, but you then have to get chunks of the string up to the Len of the string, which will change once a space is found
HTH
Steve
Hi John
I would normally use an array of characters, basic idea being:-- Loop thru the array looking for space character
- If found, save the array index where the space was found
- loop thru the remaining elements, moving them up one index
- Starting at the index you saved, loop thru the array looking for space character
- Go to 2
Of course you could also use a string and the Mid function, but you then have to get chunks of the string up to the Len of the string, which will change once a space is found
HTH
Steve
This worked for me in the intermediate window
?replace("N13 4EH"," ","")
gave
N134EH
i.e. replace all spaces with nothing.
NeoPa 32,556
Expert Mod 16PB
This worked for me in the intermediate window - ?Replace("N13 4EH"," ","")
gave
N134EH
i.e. Replace all spaces with nothing.
Lysander got my (therefore the best :D) answer in before me.
I find this one of the functions I use the most in my code (along with Nz() & IIf()).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: p s |
last post by:
hi all
i have a vb6 project, one of the functions is to read in a text file and
place it into an array
problem is, when people use the TAB key in the original file that is read, i
just get the...
|
by: Purdy |
last post by:
I have an asp.net application.
i export to excel, in exporting to excel i use an xslt to define the
columns and look.
on one of the fields i need the word 'qty' but i need it to look like
' ...
|
by: SKG |
last post by:
i have leading spaces in my database fields. When they appear in the
datagrid in browser,
they seem to be truncated. I did view source in browser and found that there
are indeed spaces but when...
|
by: usenet |
last post by:
I would like, if it's possible, to set the value of a field in a table
to a number of spaces. One space would be fine, I just want to be
able to set the field to a default value that's not NULL...
|
by: tommy |
last post by:
Hi all,
I' m adding strings to some fields in my table via Access. The strings
sometimes have trailing spaces and I really need to have it that way,
but Access truncates trailing spaces. How can...
|
by: Mike Johnson |
last post by:
How do I remove a item that's been selected from a listview?
I'm using Visual Basic 2005 express edition. Thanks
|
by: andrewbda |
last post by:
I am having a problem where fields are being filled by spaces when data
is put in.
I.e. in a text field length 50, whatever is stored in there is padded
by spaces and the field length is always...
|
by: buggtb |
last post by:
Hi Guys,
I've been given the joyous task of updating some very old scripts at work and I could do with a little help.
Our Unix system dumps text files to pseudo spoolers that our windows...
|
by: maryanncanor |
last post by:
Hi everyone,
My problem is whenever I export a report to a textfile. The output textfile have blank spaces.
Here is my query:
SELECT ( & '|' & & '|'...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |