Opening a file in "quick view" mode?

Jibbadiah

James
Local time
Tomorrow, 02:07
Joined
May 19, 2005
Messages
282
Folks,

I have a file transfer form on my database which works well.
Sometimes the files get transferred in the wrong format (ascii versus binary transfer methods)
We can't ascertain which format will be correct in advance (sometimes a bigger file requires a different method).
Currently the way that we determine if the file is in the correct format is to right click the file and open it in "quick view"
This allows us to see if the file contains extra carriage returns (additional blank lines between records).

Does anyone know how to open a .txt file using the quick view utility from Access VB?
Alternatively, do you have another means to check that the file is in a usable state after transfer?

Cheers,

J.
 
Jibbadiah said:
Folks,

I have a file transfer form on my database which works well.
Sometimes the files get transferred in the wrong format (ascii versus binary transfer methods)
We can't ascertain which format will be correct in advance (sometimes a bigger file requires a different method).
Currently the way that we determine if the file is in the correct format is to right click the file and open it in "quick view"
This allows us to see if the file contains extra carriage returns (additional blank lines between records).

Does anyone know how to open a .txt file using the quick view utility from Access VB?
Alternatively, do you have another means to check that the file is in a usable state after transfer?

Cheers,

J.

I'm not sure about the skills qualifier, nor am I entirely clear about the Quick View utility, but here goes anyway... :eek:

I checked the Object Browser in MS Access 2000, and don't see an QuickView object. There's QuickInfo, QuickPrint, and QuickWatch. Those three objects appear to be related to watching variables through the VBE.

Have you considered the Microsoft Scripting Runtime object to test the file in question?

You might consider the following:
- open a file as textstream
- read lines through a buffer

If an error is thrown (or non-text characters are read into a text buffer), I conclude that the file is binary. If no error occurs, I think I have a text file.

The programmer needs to decide if he/she wants to test every line (and character) of the textstream. For lengthy files, hopefully time is not an issue.
 
Thanks very much for the reply Mikeflyer.

As it goes, my Access guru has replied to a personal email, and it was a lot easier than I thought.

Normally I would use a lot of code like the following:

Code:
pathname = "c:\temp\ViewClientFile.bat"
checkexist (pathname) [COLOR=DarkGreen]'calls a separate function to delete existing files[/COLOR]

dfile = Forms![frmFTP]![destfile]
dpath = Forms![frmFTP]![destdir]
        
Open pathname For Output As #1
    Print #1, " notepad.exe "; dpath; ""; dfile; " "
Close #1

call shell (pathname)

In order to use the viewers I needed to call the application directly with the name of the file I want to open.

Code:
sName = "C:\WINNT\system32\viewers\quikview.exe c:\temp\viewclientfile.bat"

Call Shell(sName, 1)

So the original code has become:

Code:
dfile = Forms![frmFTP]![destfile]
dpath = Forms![frmFTP]![destdir]

Dim sName As String
sName = "C:\WINNT\system32\viewers\quikview.exe " & dpath & dfile

Call Shell(sName, 1)

You'll notice that for some crazy reason Microsoft chose to call their "Quick View" viewer as "Quikview"... without the "C"!!

Cheers for the suggestions.

J.
 
Jibbadiah said:
You'll notice that for some crazy reason Microsoft chose to call their "Quick View" viewer as "Quikview"... without the "C"!!

Probably to fit in with the old 8.3 naming convention of MSDOS.

Handy trick to know as well.
 
James:

I am glad you got your solution. I'm not sure that I've consciously used Quikview. I use Textpad when I'm glancing at text files through an Explorer window.

Follow up question... how do you determine (through code) if a file is in a busy state? I originally read the concern about determining the difference between a text and binary file. Does the shell process return an error message if a binary file is encountered? What about opening a busy file through Quikview?
 

Users who are viewing this thread

Back
Top Bottom