Help with linking external documents???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to creating databases so please excuse the possibly dumb question

I am trying to create a basic client database, and think the basic 'contact management' template in Access 2003 is a good starting point. I have made a few small changes to fit the needs of our business. However, I would like to create a command button (or a better solution?) to link/view all the documents we have (99% word documents) that relate to that particular client. Can someone tell me how this can best be done?? Thank you very much!
 
Hi,

You need to create another table, called Documents
This table will have the following fields:

Doc_ID autonumber (primary key)
Contact_ID long (foreign key, pointing to a contact record in Contacts
table)
Document name
Document path
.....(any other relevant fields, like keywords, etc)

Then you can add a subform to your Contacts form, with documents for current
contact.
This subform will be based on Documents table, and related using Contact_ID
to main form (Contacts form)

On your main form you can add buttons to add a document, delete a document
and view document
For add document, you have to use a dialog to browser for a file, then add a
new record to Documents table.
To let user select a file, you can use API functions as shown at
http://www.mvps.org/access/api/api0001.htm that lets you use the standard
File dialog to get a filename from the user.

To view the linked file, you should use the Shellexecute API call, as
following

Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal lpParameters _
As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long

Global Const SW_SHOWNORMAL = 1

......

ShellExecute(0, "open", your_field_which_store_pathname, "", "C:\",
SW_SHOWNORMAL)

This call will open any document in default viewer, as registered in Windows
Registry (so DOC will be open in Word, XLS in Excel, HTM in IE, PDF in
Acrobat Reader, etc)

If you need more details / info, you can email me back.

HTH
Bogdan Zamfir
________________________________

Independent consultant









jrs said:
I am new to creating databases so please excuse the possibly dumb question.

I am trying to create a basic client database, and think the basic
'contact management' template in Access 2003 is a good starting point. I
have made a few small changes to fit the needs of our business. However, I
would like to create a command button (or a better solution?) to link/view
all the documents we have (99% word documents) that relate to that
particular client. Can someone tell me how this can best be done?? Thank
you very much!
 
Thank you very much!!! Will try that

----- Bogdan Zamfir wrote: ----

Hi

You need to create another table, called Document
This table will have the following fields

Doc_ID autonumber (primary key
Contact_ID long (foreign key, pointing to a contact record in Contact
table
Document nam
Document pat
.....(any other relevant fields, like keywords, etc

Then you can add a subform to your Contacts form, with documents for curren
contact
This subform will be based on Documents table, and related using Contact_I
to main form (Contacts form

On your main form you can add buttons to add a document, delete a documen
and view documen
For add document, you have to use a dialog to browser for a file, then add
new record to Documents table
To let user select a file, you can use API functions as shown a
http://www.mvps.org/access/api/api0001.htm that lets you use the standar
File dialog to get a filename from the user

To view the linked file, you should use the Shellexecute API call, a
followin

Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation
As String, ByVal lpFile As String, ByVal lpParameters
As String, ByVal lpDirectory As String, ByVal nShowCmd
As Long) As Lon

Global Const SW_SHOWNORMAL =

.....

ShellExecute(0, "open", your_field_which_store_pathname, "", "C:\"
SW_SHOWNORMAL

This call will open any document in default viewer, as registered in Window
Registry (so DOC will be open in Word, XLS in Excel, HTM in IE, PDF i
Acrobat Reader, etc

If you need more details / info, you can email me back

HT
Bogdan Zamfi
_______________________________

Independent consultan









jrs said:
I am new to creating databases so please excuse the possibly dum question
'contact management' template in Access 2003 is a good starting point.
have made a few small changes to fit the needs of our business. However,
would like to create a command button (or a better solution?) to link/vie
all the documents we have (99% word documents) that relate to tha
particular client. Can someone tell me how this can best be done?? Than
you very much
 
Back
Top