Solved

Open File Names with Single Quotes in the File Name!

Posted on 2003-11-20
3
568 Views
Last Modified: 2010-05-01
I have a that gets sent to a Main Frame system which requires the file name to have single quotes on each end of the file.

Example:
'PSDH.XM.M2.P900.CGS.DXMEXT00'

This is a text file you can view in Notepad, and I'm trying to write a program that opens the file and verifies the date in the header record before it gets sent to the Main Frame to ensure the operator is sending the correct file.

I'm unable to open the file because the command doesn't work:

sFilePath = "c:\'PSDH.XM.M2.P900.CGS.DXMEXT00'"

Open sFilePath For Output As lFileNum

The sFilePath ends up looking like this in debug: "c:\'PSDH.XM.M2.P900.CGS.DXMEXT00"'

Any ideas on how I can read this file in to verify the header record???

Thanks,
smithmrk
0
Comment
Question by:smithmrk
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Z_Beeblebrox earned 500 total points
ID: 9790284
What exactly is the problem? I tried something similar here and it worked fine. Why are you opening the file for output if you want to read the file header?

Zaphod.
0
 

Author Comment

by:smithmrk
ID: 9790398
Ok Your Right I had Output instead of Input!

However now it jumps right to Close File??
Error 62 Past End of File?

I only want the first line of the file anyway.
Let me know what happens on your end.

Thanks!

sFilePath = "c:\'PSDH.XM.M2.P900.CGS.DXMEXT00'"

On Error GoTo ErrorHandler

lFileNum = FreeFile

Open sFilePath For Input As lFileNum

Do Until EOF(lFileNum) = True
    Line Input #lFileNum, sFileLine
    sFileDate = sFileLine
    Exit Do
Loop

Close #lFileNum

0
 

Author Comment

by:smithmrk
ID: 9790442
OK I'm a Dumb Ass!

When I had the Output Statement instead of the Input Statement I over wrote my file with nothing in it.

Therefore once I changed the Output to Input using the same file there was nothing to read in.

Dumb Ass!

Long Day, but thanks for your help and pointing out my Output vs Input statement.  I was so sure it had to do with the signal quote thing.

You guys rock!
Thanks again,
smithmrk
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now