G
Guest
The following code is used to change the picture in an image control based
on a bound text box using the page event in the report. Why does the event
not fire when the first page is displayed. It works for every page except
page 1. On page 1 there is not a picture since I set up the image control
without a picture, but every subseqeunt page has the picture which is named
in the bound text box. I added just a couple of dummy records at the
beginning to get get my first page to be page 2, so my pictures would be
displayed, but I must be missing something about the event. I had tried the
format event and it corrected the problem with no pictures on page 1, but
created other more serious problems with memory when printing. Thanks.
Private Sub Report_page()
Dim strFile As String
Dim strFullPath As String
strFullPath = "C:\Documents and Settings\mcambrose\My
Documents\Ambrose\Photos\" & Me!Text58
strFile = Dir(strFullPath, vbNormal)
On Error GoTo PictureNotAvailable
Me.Image57.Picture = strFullPath
Exit Sub
PictureNotAvailable:
strFile = "C:\Documents and Settings\mcambrose\My
Documents\Ambrose\Photos\ambrose.jpg"
Me.Image57.Picture = strFile
End Sub
on a bound text box using the page event in the report. Why does the event
not fire when the first page is displayed. It works for every page except
page 1. On page 1 there is not a picture since I set up the image control
without a picture, but every subseqeunt page has the picture which is named
in the bound text box. I added just a couple of dummy records at the
beginning to get get my first page to be page 2, so my pictures would be
displayed, but I must be missing something about the event. I had tried the
format event and it corrected the problem with no pictures on page 1, but
created other more serious problems with memory when printing. Thanks.
Private Sub Report_page()
Dim strFile As String
Dim strFullPath As String
strFullPath = "C:\Documents and Settings\mcambrose\My
Documents\Ambrose\Photos\" & Me!Text58
strFile = Dir(strFullPath, vbNormal)
On Error GoTo PictureNotAvailable
Me.Image57.Picture = strFullPath
Exit Sub
PictureNotAvailable:
strFile = "C:\Documents and Settings\mcambrose\My
Documents\Ambrose\Photos\ambrose.jpg"
Me.Image57.Picture = strFile
End Sub