Newbie: Adding a linked PDF file entry from a form

W

Wanadoo

Hi,

I'm trying to add links to PDF files into my database from a command button.

I'm using the
msoFileDialogFilePicker

function to get the file name. This works OK but then I'm stuck with code to
actually populate the table.

Thanks for help

Louis
 
C

Chaz

The easiest way that I have found to do this is by inserting a hyperlink into the form instead of a command button. Just insert the hyperlink to the pdf file and then go into the properties and change them to look like a button. (bacl color, raised,..ect). I have done this to a number of my forms. It's quick and easy and as long as you don't change the name or location of the file you are set. You can update the file just keep the same name

Chaz
 
P

Pavel Romashkin

Once you get the file name string, just assign it to the record source field:

Me!pdfFileName = FName

where pdfFileName is the name of the field in the table (query) that
underlines the form you are calling the code from, and FName is the
string you obtain from the file picker.
If the target table is not the data source for the form, you can use an
append query to insert the string:

Dim Qdef as DAO.Querydef
Set Qdef = CurrentDB.CreateQueryDef(vbNullString, "INSERT INTO
TargetTable SET pdfFileName = '" & FName & "'")
Qdef.Execute
Set Qdef = Nothing

Cheers,
Pavel
 

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