Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 31st, 2006, 03:25 AM
Authorized User
 
Join Date: Jul 2006
Location: Kolkata, West Bengal, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to lawsoncobol
Default Opening Text file in Binary mode for reading

hello friends,

     I am opeining a text file in Binary mode for input which has data given below and then writing it to CSV file

Data in Text file
ID Name strQtrTxbl strYtdTxbl
485741167 Abens, Stuart F. 6,565.24 6,565.24

Syntax used

    Open File For Binary As #1

And then after reading the data,I am writing the data to output CSV file

                strQtrTxbl = Trim(Mid(strData, 43, 15))
                strYtdTxbl = Trim(Mid(strData, 58, 15))

But as you can see the data in strQtrTxbl = 6,565.24 so when i am trying to write it to CSV file, it is getting wrritten in two different fields as program is considering "," as delimiter

My confusion is when i have opened the file in Binary mode then "," should not be considered as delimiter, it should be considered as string

Question - Please help me where i am wrong ?

Note : i can remove the "," from the data and then write also <- this i know



Thanks and Regards
Lawson, COBOL
__________________
Thanks and Regards
Lawson, COBOL
Reply With Quote
  #2 (permalink)  
Old August 3rd, 2006, 04:01 AM
Authorized User
 
Join Date: Jul 2006
Location: Kolkata, West Bengal, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to lawsoncobol
Default

Hi friends

i figured out how to deal with "," in the data

example : if you have "," in the data as salary 66,345 then we can add double quotes

If InStr(strField, ",") <> 0 Then strField = Chr(34) & strField & Chr(34)

Chr(34) = "

then the value will be stored in CSV file would be "66,345"

now when importing the data from CSV to MS access database we have to LINK TABLES in table section ( in table section right click in white area)

Select the table and then click LINK then click Advance
Fixed Delimiter = ,
Text Qualifier = "

then the data will be imported to MS access database as 66,345
Previously data was transfered as 66 and then in another column 345




Thanks and Regards
Lawson, COBOL
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read Text file and convert to Binary file VB.net sjlsysprg1 Pro VB.NET 2002/2003 4 June 29th, 2007 06:53 AM
Binary Search on a text file scoobie Pro Java 1 August 25th, 2006 12:43 AM
SQL 2000 database / text file / binary file pallone Javascript How-To 3 January 28th, 2005 01:26 PM
Reading field of 'Long' datatype from binary file peri C# 0 January 2nd, 2005 08:50 AM
Reading from a text file and writing to a Binary 1 scott01 C++ Programming 0 July 28th, 2003 03:59 AM



All times are GMT -4. The time now is 01:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.