Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

csv file breaking after numeric characters and special characters

Status
Not open for further replies.

airwolf09

Technical User
Dec 7, 2012
24
US
The plan

1 Access Database creates a csv file
2 Data is read by Reflections 2011 VBA code
3 Data is passed to the mainframe via Reflections 2011 VBA

The problem

1 Access Database creates the csv file (NO PROBLEM)
2 Data is read by Reflections 2011 VBA code (PROBLEM)

A) If leading numeric number, anything on the string following the digits would no be on the output. All information is passed via variables​
Example: Input via csv file "3rd Floor". The output would be "3"​
Example 2: Input via csv file "The 3rd Floor". The output would be "The 3"​

B) If special characters, anything on the string following the character would no be on the output. All information is passed via variables​
Example: Input via csv file "The_Floor". The output would be "The"​
Example 2: Input via csv file "The_Upper_3rd_Floor". The output would be "The"​

3 Data is passed to the mainframe via Reflections 2011 VBA (NO PROBLEM)

Questions

1 Why is numeric and special characters breaking up the string?
2 Is there a way to avoid the break up?
3 Any alternatives?

Thank You
 
Hi,

Where is the Reflections 2011 VBA code?

Please post.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Sub FBI_RA_BOOKING()

Dim hostSettleTimeout As Integer
Dim hostSettleTime As Integer
Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer
Dim hiddenTextEntry As String

hostSettleTimeout = 5000
hostSettleTime = 300

Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen

Dim myUser As String
myUser = Environ("username")

Dim TicketNumberFile As String

TicketNumberFile = InputBox("Enter the Ticket Number", , , vbCritical)

If TicketNumberFile = vbNullString Then
Exit Sub
End If

Dim fso3
Dim folderTicketFilePath As String

Set fso3 = CreateObject("Scripting.FileSystemObject")
folderTicketFilePath = "S:\Manual_Booking\BOOKING\RA"
fileTicket = (TicketNumberFile)
FullPath = (folderTicketFilePath) & "\" & (fileTicket) & ".csv"

' Reading File from S:\Manual_Booking\BOOKING\RA\(TICKET NUMBER).csv

MyFile = (FullPath)
Open MyFile For Input As #1 ' Open file for input.

'*************************************************************************************************************************************************************
' VARIABLES
'*************************************************************************************************************************************************************
Input #1, Id, CustName, CustAddress1A, CustAddress1B, CustAddress2, CustAddress3 ' Read data into variables.

'Customer Name/Address

osCurrentScreen.SendKeys "1"
Call Wait_50
Call Enter_50
Call osCurrentScreen.SendKeys(CustName) ' 4 CustName
Call Wait_50
Call Enter_50
osCurrentScreen.SendKeys "2"
Call Wait_50
Call Enter_50
Call osCurrentScreen.SendKeys(CustAddress1A) ' 5 CustAddress1A
Call Wait_50
osCurrentScreen.SendKeys " "
Call Wait_50
Call osCurrentScreen.SendKeys(CustAddress1B) ' 6 CustAddress1B
Call Wait_50
Call Enter_50
osCurrentScreen.SendKeys "3"
Call Wait_50
Call Enter_50
Call osCurrentScreen.SendKeys(CustAddress2) ' 7 CustAddress2
Call Wait_50
Call Enter_50
osCurrentScreen.SendKeys "4"
Call Wait_50
Call Enter_50
Call osCurrentScreen.SendKeys(CustAddress3) ' 8 CustAddress3
Call Wait_50
Call Enter_50

End Sub
 
I have no idea why is breaking up the data on the numeric and special characters. May be the way I am opening the file??? but I am not sure. Thanks for the help.
 
Please post a typical record, all 6 values EXACTLY AS THEY APPEAR IN THE TEXT FILE.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
1 Joe Doe 1 Main St Downtown Building 2nd Floor Room 13
2 Bruce Wayne 9 Batcave Rd Bat Cave Building 1st Floor Room 1
3 Bruce Lee 1 Karate Way Chinatown Building 3rd Floor Room 5
4 Jet Li 26_Karate_Way Chinatown_Building 4th Floor Room 6

The results would be

1 Joe Doe 1 Downtown Building 2 Room 13
2 Bruce Wayne 9 Bat Cave Building 1 Room 1
3 Bruce Lee 1 Chinatown Building 3 Room 5
4 Jet Li 26 Chinatown 4 Room 6

I lost data after Numeric Characters and Special Characters.
 
 http://files.engineering.com/getfile.aspx?folder=8a8bcc5e-d53d-4e55-8311-4b8160e9a42d&file=Sample_Address_FILE.csv

Declare your input variables explicitly as String.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Thank You. I didn't even realized the variables were not declared. I was scratching my head and it was a simple fix.
Have a great day!!!
 
It is a best and accepted practice to explicitly declare all variables appropriately for type and scope.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top