A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

linking pictures



 
 
Thread Tools Display Modes
  #1  
Old February 17th, 2010, 05:52 PM posted to microsoft.public.access.forms
mary
external usenet poster
 
Posts: 1,946
Default linking pictures

I have seen the many discussions on linking pictures and am running into
trouble. I am using Access 2003.
I have tried using the sample "Pictures2k" but can't figure out where I am
going wrong.

The form is based off a query, which brings together a bunch of information.
1. Placed photos in the same folder as the database.
2. Created a text field in our records table, named per 2k instructions
3. Added the name of one of the photographs to the field (example: name.jpg)
4. Added the field to the query from which the form is based
5. Created a picture frame, renamed it
6. For the form, I created the OnCurrent and OnActivate events by copying
and pasting.

I have been rooting around for about a day and a half trying to find what I
have missed. But I can't seem to figure out where I went wrong. I don't have
any errors, but the photo never shows.

Thanks ahead of time for your help!


  #2  
Old February 17th, 2010, 06:19 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default linking pictures

On Wed, 17 Feb 2010 09:52:05 -0800, Mary
wrote:

I have seen the many discussions on linking pictures and am running into
trouble. I am using Access 2003.
I have tried using the sample "Pictures2k" but can't figure out where I am
going wrong.

The form is based off a query, which brings together a bunch of information.
1. Placed photos in the same folder as the database.
2. Created a text field in our records table, named per 2k instructions
3. Added the name of one of the photographs to the field (example: name.jpg)
4. Added the field to the query from which the form is based
5. Created a picture frame, renamed it
6. For the form, I created the OnCurrent and OnActivate events by copying
and pasting.

I have been rooting around for about a day and a half trying to find what I
have missed. But I can't seem to figure out where I went wrong. I don't have
any errors, but the photo never shows.

Thanks ahead of time for your help!


Please post your code. No way we can possibly debug it based on what you
posted!

Examples of the filename, foldre name, and form controls relevant to the
problem would be helpful.
--

John W. Vinson [MVP]
  #3  
Old February 17th, 2010, 07:40 PM posted to microsoft.public.access.forms
mary
external usenet poster
 
Posts: 1,946
Default linking pictures

Thanks for responding, I should have known to add code, but in this case I am
kind of guessing what code to give you... so here is my best shot...:

Image frame on the form was renamed ImgStock
Text box on form has control source txtPhotoGraph and name txtPhotoGraph

CODE FOR THE QUERY (deleted many of the fields, because it was 3 pages in
word):

SELECT Trim([LastName] & ", " & [Title] & " " & [FirstName]) AS [Index
Name], tblPermanentRecordInformation.txtPhotoGraph,
tblPermanentRecordInformation.LastName,
tblPermanentRecordInformation.FirstName,
tblPermanentRecordInformation.BirthDate,
tblPermanentRecordInformation.BirthCity,
tblPermanentRecordInformation.BirthState,
tblPermanentRecordInformation.RelativeAddress,
tblPermanentRecordInformation.HigherEducation,
tblPermanentRecordInformation.EntranceDate,
FROM tblPermanentRecordInformation INNER JOIN qryNameLookupDNDPermRecord ON
tblPermanentRecordInformation.[ID Number] = qryNameLookupDNDPermRecord.[ID
Number]
WHERE (((Trim([LastName] & ", " & [Title] & " " &
[FirstName]))=[Forms]![frmPermanentRecordInformation]![frmFindPermanentRecord].[Form]![cboName]));


CODE FOR THE FORM (the field name is txtPhotoGraph instead of StockGraph):

Option Compare Database

Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click

DoCmd.Close

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click

End Sub

Private Sub Form_Activate()
'find the path of the current database
'which is where the jpegs are stored
Set db = CurrentDb
FileName = db.Name
pathname = Mid(FileName, 1, Len(FileName) - Len(Dir(FileName)))
End Sub

Private Sub Form_Current()
On Error GoTo Err_cmdClose_Click

'set the picture path
Me.ImgStock.Picture = pathname & Me.txtPhotoGraph

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
If Err.Number = 2220 Then 'can't find the file
Resume Next
Else
MsgBox Err.Description
Resume Exit_cmdClose_Click
End If
End Sub


Private Sub txtPhotoGraph_AfterUpdate()
On Error Resume Next
Me![ImgStock].Picture = Me![txtPhotoGraph]
End Sub



If that's not enough, please let me know what else you will need. I really
appreciate your help.


"John W. Vinson" wrote:

On Wed, 17 Feb 2010 09:52:05 -0800, Mary
wrote:

I have seen the many discussions on linking pictures and am running into
trouble. I am using Access 2003.
I have tried using the sample "Pictures2k" but can't figure out where I am
going wrong.

The form is based off a query, which brings together a bunch of information.
1. Placed photos in the same folder as the database.
2. Created a text field in our records table, named per 2k instructions
3. Added the name of one of the photographs to the field (example: name.jpg)
4. Added the field to the query from which the form is based
5. Created a picture frame, renamed it
6. For the form, I created the OnCurrent and OnActivate events by copying
and pasting.

I have been rooting around for about a day and a half trying to find what I
have missed. But I can't seem to figure out where I went wrong. I don't have
any errors, but the photo never shows.

Thanks ahead of time for your help!


Please post your code. No way we can possibly debug it based on what you
posted!

Examples of the filename, foldre name, and form controls relevant to the
problem would be helpful.
--

John W. Vinson [MVP]
.

  #4  
Old February 17th, 2010, 09:30 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default linking pictures

On Wed, 17 Feb 2010 11:40:01 -0800, Mary
wrote:

Thanks for responding, I should have known to add code, but in this case I am
kind of guessing what code to give you... so here is my best shot...:


Try moving your Form's Activate code (which fires *before* the textbox
contains the filename) to the form's Current event. If that doesn't work post
back and I'll have a more detailed look.
--

John W. Vinson [MVP]
  #5  
Old February 18th, 2010, 10:10 PM posted to microsoft.public.access.forms
mary
external usenet poster
 
Posts: 1,946
Default linking pictures

You have brought a smile to my day! Thanks for sharing your knowledge.

"John W. Vinson" wrote:

On Wed, 17 Feb 2010 11:40:01 -0800, Mary
wrote:

Thanks for responding, I should have known to add code, but in this case I am
kind of guessing what code to give you... so here is my best shot...:


Try moving your Form's Activate code (which fires *before* the textbox
contains the filename) to the form's Current event. If that doesn't work post
back and I'll have a more detailed look.
--

John W. Vinson [MVP]
.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.