This is the add code
' User asked to add a new photo
Dim strPath As String
Dim strPath As String
' If you want to use the Office FileDialog object,
' comment out the following code and remove the
' comments from the block below
' ***** Begin ComDlg code
' Establish a new ComDlg object
With New ComDlg
' Don't allow multiple files
.AllowMultiSelect = False
' Set the title of the dialog
.DialogTitle = "Locate note PDF File"
' Set the default directory
.Directory = CurrentProject.Path & "\Pictures\"
' .. and file extension
.Extension = "pdf"
' .. but show all graphics files just in case
'.Filter = "Image Files (.bmp, .jpg, .gif, .pdf)|*.bmp;*.jpg;*.gif;*.pdf"
.Filter = "PDF Files (.pdf)|*.pdf"
' Tell the common dialog that the file and path must exist
.ExistFlags = FileMustExist + PathMustExist
If .ShowOpen Then
strPath = .FileName
Else
Exit Sub
End If
End With
' ***** End ComDlg code
' comment out the following code and remove the
' comments from the block below
' ***** Begin ComDlg code
' Establish a new ComDlg object
With New ComDlg
' Don't allow multiple files
.AllowMultiSelect = False
' Set the title of the dialog
.DialogTitle = "Locate note PDF File"
' Set the default directory
.Directory = CurrentProject.Path & "\Pictures\"
' .. and file extension
.Extension = "pdf"
' .. but show all graphics files just in case
'.Filter = "Image Files (.bmp, .jpg, .gif, .pdf)|*.bmp;*.jpg;*.gif;*.pdf"
.Filter = "PDF Files (.pdf)|*.pdf"
' Tell the common dialog that the file and path must exist
.ExistFlags = FileMustExist + PathMustExist
If .ShowOpen Then
strPath = .FileName
Else
Exit Sub
End If
End With
' ***** End ComDlg code
' Set an error trap
On Error Resume Next
' Set the image
Me.imgPDF.SourceDoc = strPath
Me.imgPDF.Action = acOLECreateLink
' Make sure that "took" OK
If Err = 0 Then
' Got a good file selection ...
' See if the photo is in a subpath of this project
' If Left(strPath, Len(CurrentProject.Path)) = CurrentProject.Path Then
' Strip it off and store a relative path
' strPath = Mid(strPath, Len(CurrentProject.Path) + 2)
'End If
' Set the path in the record
Me.txtPhoto = strPath
' Hide the message
Me.lblMsg.Visible = False
' and reveal the new photo
Me.imgPDF.Visible = True
Else
' OOOps.
' Clear photo
Me.txtPhoto = Null
' Hide the frame
Me.imgPDF.Visible = False
' Clear the image
Me.imgPDF.Picture = ""
' Set the message
Me.lblMsg.Caption = "Failed to load the picture you selected. Click Add to try again."
' Make it visible
Me.lblMsg.Visible = True
End If
' Put focus in a safe place
Me.txtNoteDate.SetFocus
End Sub
I stepped through it and drops right to the Else statement. I Changed the name of the control from imgPhoto to imgPDF.
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"Only those who will risk going too far can possibly find out how far one can go."
On , Art Lorenzini <dbalorenzini@yahoo.com> wrote:
I have made the changes but for some reason it is not saving the path so I have to locate the PDF file each time I open the record.
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"Only those who will risk going too far can possibly find out how far one can go."
On Thursday, May 29, 2014 3:48 PM, "wrmosca@comcast.net [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
Art - replace the image control with an OLEBound control. Keep the same name so you have less work to do.
Change this line where ever it exists:
Me.imgMember.Picture = strPath
to this:
Me.OLEBound1.SourceDoc = strPath
Me.OLEBound1.Action = acOLECreateLink
Also, if you are using a common dialog to get the path, change the filter/extension to PDF
With New ComDlg
' Don't allow multiple files
.AllowMultiSelect = False
' Set the title of the dialog
.DialogTitle = "Locate Member picture File"
' Set the default directory
.Directory = CurrentProject.Path & "\Pictures\"
' .. and file extension
.Extension = "pdf"
' .. but show all PDF files just in case
.Filter = "PDF Files (.pdf)|*.pdf"
' Tell the common dialog that the file and path must exist
.ExistFlags = FileMustExist + PathMustExist
If .ShowOpen Then
strPath = .FileName
Else
Exit Sub
End If
End With
Regards,
From: "Art Lorenzini dbalorenzini@yahoo.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: "MS Access Professionals" <MS_Access_Professionals@yahoogroups.com>
Sent: Thursday, May 29, 2014 11:06:31 AM
Subject: Re: [MS_AccessPros] Re: Working with PDFS in Access 2013
Bill Mosca
To: "MS Access Professionals" <MS_Access_Professionals@yahoogroups.com>
Sent: Thursday, May 29, 2014 11:06:31 AM
Subject: Re: [MS_AccessPros] Re: Working with PDFS in Access 2013
Bill,
I am sorry but I don't even know where to begin with that. I have attached a screen shot of what it looks like right now. Like this is based off images and not PDF files.
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
alorenzini@crhanetwork.org
"Only those who will risk going too far can possibly find out how far one can go."
On Thursday, May 29, 2014 12:40 PM, "wrmosca@comcast.net [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
Art
Use a bound OLE control.
Private Sub Command1_Click()
Me.OLEBound4.SourceDoc = "C:\MyFolder\MyPDFfile.pdf"
Me.OLEBound4.Action = acOLECreateLink
End Sub
-Bill
[Non-text portions of this message have been removed]
I am sorry but I don't even know where to begin with that. I have attached a screen shot of what it looks like right now. Like this is based off images and not PDF files.
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
alorenzini@crhanetwork.org
"Only those who will risk going too far can possibly find out how far one can go."
On Thursday, May 29, 2014 12:40 PM, "wrmosca@comcast.net [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
Art
Use a bound OLE control.
Private Sub Command1_Click()
Me.OLEBound4.SourceDoc = "C:\MyFolder\MyPDFfile.pdf"
Me.OLEBound4.Action = acOLECreateLink
End Sub
-Bill
[Non-text portions of this message have been removed]
__._,_.___
Posted by: Art Lorenzini <dbalorenzini@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (9) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar