473,382 Members | 1,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

VB to Clean up Long Ship To Address

I am using bar tender hooked up to a MS Access DB to print labels. I
have a problem with the Access table. The problem is that the "Ship
to" field is written like this:

Warehouse "adidas, Ltd." /142181, MOSKOVSKAYA OBLAST,/KLIMOVSK,
BEREGKOVSKYI/PROEZD 17-A 38290

I need it formated like this:

Warehouse "adidas, Ltd."
142181, MOSKOVSKAYA OBLAST,
KLIMOVSK, BEREGKOVSKYI/PROEZD 17-A 38290

My question is, how can I break this up. I can add columns to my DB
as

address 1
address 2
address 3
and so on, but I need to be able to read between the "/". Also,
bartender as a spot for VB, so I may be able to break it up inside the
app. But I still don't know how to read only between the "/".

May 1 '07 #1
3 1719
A cheap and dirty way!

Export the address database to word doc.
Import it as a coma delimited file.

I am sure there are Access Gurus here who can offer you professional advice,
bypassing my primitive solution.

--
Jim Hagani
QA Manager
TFC Manufacturing
P: (562) 426-9559
F: (562) 426-9717
jh*****@tfcmfg.com
"Starke" <st********@hotmail.comwrote in message
news:11**********************@c35g2000hsg.googlegr oups.com...
>I am using bar tender hooked up to a MS Access DB to print labels. I
have a problem with the Access table. The problem is that the "Ship
to" field is written like this:

Warehouse "adidas, Ltd." /142181, MOSKOVSKAYA OBLAST,/KLIMOVSK,
BEREGKOVSKYI/PROEZD 17-A 38290

I need it formated like this:

Warehouse "adidas, Ltd."
142181, MOSKOVSKAYA OBLAST,
KLIMOVSK, BEREGKOVSKYI/PROEZD 17-A 38290

My question is, how can I break this up. I can add columns to my DB
as

address 1
address 2
address 3
and so on, but I need to be able to read between the "/". Also,
bartender as a spot for VB, so I may be able to break it up inside the
app. But I still don't know how to read only between the "/".

May 1 '07 #2
You will have to do a little bit of programming - something like this:

Dim DB As DAO.Database, RS As DAO.Recordset, str1() As String, i As
Integer

Set DB = CurrentDB
Set RS = DB.OpenRecordSet("yourTbl")
Do While Not RS.EOF
str1 = Split(RS!Address, "/")
For i = 0 To Ubound(str1)
Debug.Print(str1(i)
Next
RS.MoveNext
Loop

Whenever you have delimeters, you can use the Split function to convert
the string containing the delimeters into an array of string. Then you
can get the desired format. In your report you would place code similar
to this in the Report Section of the Report Code Module:

Note: make the variables module level vars (declare at the top of the
module)

Private Sub Report_Open(Cancel As Integer)
Set DB = CurrentDB
Set RS = DB.OpenRecordSet("yourTbl")
End Sub

then in the Detail section you could do something like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
str1 = split(RS!Address, "/")
txt0 = str1(0)
txt1 = str1(1)
txt2 = str1(2)

RS.MoveNext
End Sub

Good Luck

Rich

*** Sent via Developersdex http://www.developersdex.com ***
May 1 '07 #3
On 1 May 2007 11:32:00 -0700, Starke <st********@hotmail.comwrote:

select Replace(ShipTo, "/", Chr$(13) & Chr$(10)) from SomeTable

-Tom.
>I am using bar tender hooked up to a MS Access DB to print labels. I
have a problem with the Access table. The problem is that the "Ship
to" field is written like this:

Warehouse "adidas, Ltd." /142181, MOSKOVSKAYA OBLAST,/KLIMOVSK,
BEREGKOVSKYI/PROEZD 17-A 38290

I need it formated like this:

Warehouse "adidas, Ltd."
142181, MOSKOVSKAYA OBLAST,
KLIMOVSK, BEREGKOVSKYI/PROEZD 17-A 38290

My question is, how can I break this up. I can add columns to my DB
as

address 1
address 2
address 3
and so on, but I need to be able to read between the "/". Also,
bartender as a spot for VB, so I may be able to break it up inside the
app. But I still don't know how to read only between the "/".
May 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Craig Thomson | last post by:
I was wondering what people do with text provided by the user in a form. Some cleaning needs to be done at some stage if you are going to be putting it in a database or displaying it etc. But when...
0
by: Bill Davy | last post by:
I am working with MSVC6 on Windows XP. I have created an MSVC project called SHIP I have a file SHIP.i with "%module SHIP" as the first line (file is below). I run SHIP.i through SWIG 1.3.24...
45
by: Curt Geske | last post by:
I'm suprised no one suggested a union! #include <stdio.h> union _x { long lng; char byt; } X; void main( void )
16
by: Blue Apricot | last post by:
X-No-Archive How long will Classic ASP be supported by Microsoft? Should I start learning ASP.NET? Is it hard if you already know ASP? Blue Apricot
5
by: Rob R. Ainscough | last post by:
I have a moderately sized web application (30 pages, and 20 DLLs) that takes 10-20 minutes to "Build Solution" after I do a "Clean Solution" -- this is ONLY apparent after a "Clean Solution" I...
2
by: Ronald | last post by:
I just started with dotnetnuke, and with a wrong login (wrong password on a clean install i can crash the application pool from IIS. (when i login with the right username/password information the...
4
by: Jeeran | last post by:
We use an ISAPI filter to convert long urls into short clean ones. For example: "Site.com/user/john/" Is re-written as: "Site.com/user/userinfo.aspx?uid=john" Now, "userinfo.aspx" contains a...
5
by: basoul | last post by:
I have to make a game with 15 x 26 grid sigular array (array of 390 charecters) and im supose to load the ships which are charecters horozontally. only 4 are needed and the function im stuck on is...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.