linking records compiling error - method or data member not found

CuriousGeorge

Registered User.
Local time
Today, 15:45
Joined
Feb 18, 2011
Messages
131
Hello,

Just want the user to be able to add file paths to records. Using following code:

Code:
Option Compare Database
Option Explicit
 
Private Sub LinkFile_Click()
Dim File As String
File = Me.FileName
Application.FollowHyperlink "C:\Users\SSS787\ReadLog_new" & File
End Sub

Error msg: " method or data member not found "

Im new to databases and the VBA language.

As ive understood "Me." is referring to the current form. The files in the directory have different names with endings like *.D00 *.D01 etc. If the filenames are different, how do I define "FileName"? I assume i have to change that in the code? =)

Also, does the type for each record has to be of type "hyperlink" or can it be "text"?

Thanks
 
What kind of files are they?

.D001 (for example) doesn't look like a valid file extension. If it's not a file extension then it's not an intuitive filename to have .D001 as the last set of characters in a file name.
 
Hi vbaInet,

They are files containing binary values. Im using code written in c to convert them into 'normal' data containing decimals.

I've been adviced as a first step to just store the file names as links into the records of a table and after that use an importing method to import and convert the data.

So i want the user to be able to just browse these files and that the filenames are stored (or linked) in a record.

Files are like: 0000000027.D00 0000000025.D01 etc.

Thanks
 
So these are text files?

Why the .D001 syntax? Why not something like 000000027-D001.txt ?
 
The files have that extension when collected from the meassuring equipment. Since there are going to be a large amount of files it would be convenient if not having to rename all the files.

Is there a way to get around this?

Cheers
 
It looks like a custom format.

Does the file open in Notepad when double-clicked?
 
no it doesn't unfortunately. Well yes if u choose notepad but the content is all mixed up with "wing ding" kinda symbols.
 
If there's no associated program to open the file, I don't see why you're using FollowHyperlink?

Is it that all you want to do is save the full path of the file into a field?
 
yeah exactly, i was adviced doing so because it would make my import routine more flexible later on. Since im new to access and VBA i appreciate all advices possible :)

Cheers
 
I actually think you're trying to Open the file associated with a record. So perhaps 0000000027 relates to something, like an ID? Is this what you're trying to achieve?
 
i can quote whats been written before, i realise i dont quite understand but maybe u can clarify;

Thank u

You will simply be storing a list of locations of where the files are.
So you will have a list of the files and the filename and location eg

c:\users\curiousgeorge\file1.d001
c:\users\curiousgeorge\file2.d001
c:\users\curiousgeorge\file3.d001

There will be a new record for each file. The files will be picked by the users but those selections will be stored in one field of a table.

Yes you will be able to get the users to use a file dialog box to enter this information into the database. But you are not attaching the file you are simply storing a text string that records the filename and location.

Once the user is happy with the selections THEN they can hit an import buttn.

My suggestion is that the separate button IMPORTS the infomration from these files previously selected and places that information within a separate table. This will be the raw information which you can then convert from binary.
 
Thanks it looks like the right place, but i cannot open the example database file within that thread. It says 'your trying to open a read only database' and when clicking ok nothing happends.:confused:
 
not sure if this is fixed now - but is it just this?

Application.FollowHyperlink "C:\Users\SSS787\ReadLog_new" & File

this will assemble, so that the last bit will be called

readlog_new0000000027.D00 - and it may be that the hyperlink cannot find this file, as you may need a file divider \ after the readlog_new.

Alternatively - if you don't have a file association with a D00 extension - then the hyperlink won't know what to do with your file.
 
still have the same problem unfortunatly, access doesnt recognize the file extensions.

Dunno how to solve this problem. There just has to be a way. Ive posted a new thread with some more detailed explanation.

See if anything is coming up.


Cheers
 
If there's no program to open the file then you will have problems. If it cannot be opened using Notepad then there's nothing that can be done in the code front. You need to either install the program that is used to open that kind of file or get them to send the file to you in a csv or xls or txt format.
 
surely the answer is to change your naming convention.

why do you have the extension as D00, D01 etc

why not incorporate this into the name

myfile_D00.txt
myfile_D01.txt

then the hyperlink will open the file with the default app for the extension.
 
CuriousGeorge mentioned that the file doesn't open properly in Notepad.
 
Yeah, the file extension originates from the way the data is collected from the equipment. It is just the way the binary data is stored.

I've rewritten the c-code a bit now though so when running the original data files with extensions *.D0# through the readlog.exe a text file is created and translated from binary to decimal data. What i mean is that its now possible to choose the file and open it with the readlog program and automatically a text file is created instead of having to run it from the cmd line.

I just need to find a way to read this into access using vba code. The question is how that's done..i.e browsing the *.D0# file - using the readlog.exe and importing the *.txt file?

Cheers
 
Last edited:

Users who are viewing this thread

Back
Top Bottom