473,466 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

access97 parsing out enter and tab spaces in fields.

does anyone know how to take out {enter} strings from a field?
for instance, i have:
"INTWEST ADJUSTMENT
ORG ILLINOIS FUND PARTICIPANT DIVIDEND".

i managed to take out extra spaces but then it
comes to {enter} and {tab} i cannot parse them out.

thanks!! jung

Dim x As Integer

Set dbs = CurrentDb
' Open recordset on tblLiveWire table.
Set rst = dbs.OpenRecordset("qryLiveWire", dbOpenDynaset)

rst.MoveFirst
Do Until rst.EOF

Do While InStr(rst![source_bank_name].Value, " ") <> 0
rst.Edit
x = InStr(rst![source_bank_name].Value, " ")

rst![source_bank_name].Value =
left(rst![source_bank_name].Value, x - 1) &
Mid(rst![source_bank_name].Value, x + 1,
Len(rst![source_bank_name].Value) - x)
rst.Update
Loop

rst.MoveNext

Loop

End Function
Nov 12 '05 #1
3 2188
On 30 Jan 2004 13:50:52 -0800, JMCN wrote:
does anyone know how to take out {enter} strings from a field?
for instance, i have:
"INTWEST ADJUSTMENT
ORG ILLINOIS FUND PARTICIPANT DIVIDEND".

i managed to take out extra spaces but then it
comes to {enter} and {tab} i cannot parse them out.

thanks!! jung

Dim x As Integer

Set dbs = CurrentDb
' Open recordset on tblLiveWire table.
Set rst = dbs.OpenRecordset("qryLiveWire", dbOpenDynaset)

rst.MoveFirst
Do Until rst.EOF

Do While InStr(rst![source_bank_name].Value, " ") <> 0
rst.Edit
x = InStr(rst![source_bank_name].Value, " ")

rst![source_bank_name].Value =
left(rst![source_bank_name].Value, x - 1) &
Mid(rst![source_bank_name].Value, x + 1,
Len(rst![source_bank_name].Value) - x)
rst.Update
Loop

rst.MoveNext

Loop

End Function


Both the Enter key and the Tab key have character codes that can be used to
search for. If you check the help files for ASCII Codes you see what they
are. The easiest way is use a Do Until...Loop. Within this loop, use
InStr() to find the desired charcter. This will indicate it's posistion in
the string if found, 0 if not. If found, assign to a variable the portion
of the string up to the posistion returned, and to another variable,
everything after. Concatenate these two halfs back together and reassign to
the orignal string being searched on. Continue this loop until InStr()
returns 0. All instances of the character looked for should now be removed.
Be careful though. If you are looking for "extra" uses of these characters,
that will be far more difficult to do accurately.
--
Mike Storr
veraccess.com
Nov 12 '05 #2
Mike Storr <st******@sympatico.ca> wrote in message news:<1w******************************@40tude.net> ...
On 30 Jan 2004 13:50:52 -0800, JMCN wrote:
does anyone know how to take out {enter} strings from a field?
for instance, i have:
"INTWEST ADJUSTMENT
ORG ILLINOIS FUND PARTICIPANT DIVIDEND".


Both the Enter key and the Tab key have character codes that can be used to
search for. If you check the help files for ASCII Codes you see what they
are. The easiest way is use a Do Until...Loop. Within this loop, use
InStr() to find the desired charcter. This will indicate it's posistion in
the string if found, 0 if not. If found, assign to a variable the portion
of the string up to the posistion returned, and to another variable,
everything after. Concatenate these two halfs back together and reassign to
the orignal string being searched on. Continue this loop until InStr()
returns 0. All instances of the character looked for should now be removed.
Be careful though. If you are looking for "extra" uses of these characters,
that will be far more difficult to do accurately.


thanks for the advise!! i ended up finding the chr(13) that represents
the "enter". here is the new code but i'm having problems stepping
into the
do while statement. what am i doing wrong?
thanks again for any help.

Set dbs = CurrentDb
' Open recordset on tblLiveWire table.
Set rst = dbs.OpenRecordset("qryLiveWire", dbOpenDynaset)

rst.MoveFirst
Do Until rst.EOF
x = InStr(rst![wire_text].Value, chr(13))
Do While InStr(rst![wire_text].Value, chr(13)) <> 0
rst.Edit
'x = InStr(rst![wire_text].Value, chr(13))
rst![wire_text].Value = left(rst![wire_text].Value, x - 1) &
Mid(rst![wire_text].Value, x + 1, Len(rst![wire_text].Value) - x)
rst.Update
Loop
rst.MoveNext
Loop
Nov 12 '05 #3
On 2 Feb 2004 14:01:40 -0800, pi******@yahoo.fr (JMCN) wrote:
Mike Storr <st******@sympatico.ca> wrote in message news:<1w******************************@40tude.net> ...
On 30 Jan 2004 13:50:52 -0800, JMCN wrote:
> does anyone know how to take out {enter} strings from a field?
> for instance, i have:
> "INTWEST ADJUSTMENT
> ORG ILLINOIS FUND PARTICIPANT DIVIDEND".
>


Both the Enter key and the Tab key have character codes that can be used to
search for. If you check the help files for ASCII Codes you see what they
are. The easiest way is use a Do Until...Loop. Within this loop, use
InStr() to find the desired charcter. This will indicate it's posistion in
the string if found, 0 if not. If found, assign to a variable the portion
of the string up to the posistion returned, and to another variable,
everything after. Concatenate these two halfs back together and reassign to
the orignal string being searched on. Continue this loop until InStr()
returns 0. All instances of the character looked for should now be removed.
Be careful though. If you are looking for "extra" uses of these characters,
that will be far more difficult to do accurately.


thanks for the advise!! i ended up finding the chr(13) that represents
the "enter". here is the new code but i'm having problems stepping
into the
do while statement. what am i doing wrong?
thanks again for any help.

Set dbs = CurrentDb
' Open recordset on tblLiveWire table.
Set rst = dbs.OpenRecordset("qryLiveWire", dbOpenDynaset)

rst.MoveFirst
Do Until rst.EOF
x = InStr(rst![wire_text].Value, chr(13))
Do While InStr(rst![wire_text].Value, chr(13)) <> 0
rst.Edit
'x = InStr(rst![wire_text].Value, chr(13))
rst![wire_text].Value = left(rst![wire_text].Value, x - 1) &
Mid(rst![wire_text].Value, x + 1, Len(rst![wire_text].Value) - x)
rst.Update
Loop
rst.MoveNext
Loop


This function will strip Chr(13) and Chr(10) from a string and return a single line string.

'============================================
Function fStripCRLFs(strIn As Variant) As String
Dim strNew As String
Dim x As Integer
Dim y As String

On Error Resume Next

If Len(strIn & "") = 0 Then
fStripCRLFs = ""
Else
strNew = ""
For x = 1 To Len(strIn)
y = Mid(strIn, x, 1)
Select Case y
Case Chr(13)
strNew = strNew & " "
Case Chr(10)
strNew = strNew
Case Else
strNew = strNew & Mid(strIn, x, 1)
End Select
Next x

fStripCRLFs = strNew
End If

On Error GoTo 0

Exit Function
'============================================
Set dbs = CurrentDb
' Open recordset on tblLiveWire table.
Set rst = dbs.OpenRecordset("qryLiveWire", dbOpenDynaset)

If rst.RecordCount<>0 Then
rst.MoveFirst
Do Until rst.EOF
x= fStripCRLFs(rst![wire_text])
If rst![wire_text] <> x Then
rst.Edit
rst![wire_text] = x
rst.Update
End If
rst.MoveNext
Loop
End If

rst.Close
Set rst = Nothing
Wayne Gillespie
Gosford NSW Australia
Nov 12 '05 #4

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

Similar topics

6
by: Allan Bruce | last post by:
I have a string like: "FL:1234ABCD:3:FileName With Spaces.txt\n" and I want to read the values separated by ':' into variables. I tried to use sscanf like this: sscanf("FL:%s:%d:%s\n",...
21
by: Scott Marquardt | last post by:
What are some good strategic approaches to using freeform text fields for data that needs to be queried? We have a product whose tables we can't change, and I need to count on a "description" field...
7
by: JMCN | last post by:
hello i'm trying to parse out some data from the below format. first of all, i import the text file into access97 table and the try to parse out.i have a code written but when i run it, it does...
5
by: LFM | last post by:
I have a table I'm importing from our SQL accounting database. The Employee Name is in one field. For the purpose of my needs, I need to extract the last name, first name and middle initial. ...
7
by: millerm | last post by:
I'm obviously new to C, and have been trying different things to get this done, but I'm at the end of the line and need some suggestions. I am reading a string in from a user, in the form of a...
0
by: Paulers | last post by:
hello VB masters I have an issue that I am hoping you can help me with. I am creating an application that accepts user input via a richtextbox. the user can enter multiple entries and I need to...
10
by: lesperancer | last post by:
you start with a small application in access97, then you have more modules and more... and you reach the point where tables like 'item' and 'employee' reach the limit and you know there's more...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
2
by: Roger | last post by:
I've got two tables in sql2005 which have an 'ntext' field when I linked the first table in access97 last week using an odbc data source the access-field type was 'memo' when I link the 2nd...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.