Solved

Open File Names with Single Quotes in the File Name!

Posted on 2003-11-20
3
570 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 / DAO 3.6 / run time error: Couldn't find installable ISAM 7 102
Can we place a tooltip on the actual vb6 form 5 48
MsgBox 4 68
Problem to With line 4 63
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 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