Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #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


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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.