Trying to link notepad .txt files to form

V

Viper53927

Hi,
I am trying to create a database with general information like names, address, company name. I am trying to put a button in a form that will open a notepad text file for each person in the database. The purpose for these text files is to keep notes for each person. I found another post in another thread that had a solution but I tried it and failed. I did not understand how to input this function properly into VB. Any help would be appreciated. My e-mail is (e-mail address removed).

Here is the post I found:

From: Dev Ashish ([email protected])
Subject: Re: how do I: protecting form button and linking notepad

Newsgroups: microsoft.public.access.forms
Date: 1998/01/14

Hi,

Look at the AllowEdits, AllowAdditions and AllowDeletions property. Behind
the toggle button, you can issue a True to all three properties of the form,
enabling the form. Setting them to False will lock the form.

Yes, you can link individual text files to each clients. Just define a new
field that contains the path and filename of the text file. Show that new
field on the form. Create a button that envokes Notepad with that filename
as a parameter. You can look at the Shell command for this. A more general
approach would be to use 16 bit APIs

Declare Function ShellExecute Lib "SHELL" (ByVal hwnd%, ByVal _
lpszOp$, ByVal lpszFile$, ByVal lpszParams$, ByVal lpszDir$, _
ByVal fsShowCmd%) As Integer

Declare Function GetDesktopWindow Lib "USER" () As Integer


Function StartDoc (DocName As String)
StartDoc = ShellExecute(GetDesktopWindow(), "Open", DocName, _
"", "C:\", 1)
End Function

Calling the function as
?startDoc("C:\Folder\sample.TXT")

would start the associated app. (you might also investigate how to wait for
the shelled process to finish. Because access code will resume execution
after calling this function.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top