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  

how to add images to a database to view in a form



 
 
Thread Tools Display Modes
  #1  
Old July 27th, 2004, 04:02 AM
Brook
external usenet poster
 
Posts: n/a
Default how to add images to a database to view in a form

Hi All,

I run a custom design business and what I am trying to
accomplish is this: I would like to be able to add
images/pictures in my database that I would be able to
view in a form. I am setting up a form to where, if I
click on a button (i.e. Pic 1) Pic 1 from my database
would show up in a image box on my form. Does anyone have
any ideas on how this can be accomplished?

Thanks,

Brook
  #2  
Old July 27th, 2004, 04:53 AM
Joe Fallon
external usenet poster
 
Posts: n/a
Default how to add images to a database to view in a form

If you are interested in storing the picture in the database check out
Stephen Lebans' web site:
http://www.lebans.com/loadsavejpeg.htm

The approved solution is to store the path and display the picture
dynamically.
How to Link a Picture to a Form:

Use an unbound image frame named: ImageFrame
and add a field to your table called ImagePath.

To add the picture to a report just use code like this in the On Format
event of the Detail Section.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me![ImageFrame].Picture = Me![ImagePath]
End Sub

In the OnCurrent event of the form use this code:

Private Sub Form_Current()
On Error GoTo Err_Form_Current

If IsNull(Me![ImagePath]) Then
Me![ImageFrame].Picture = "c:\msaccess.jpg"
Else
Me![ImageFrame].Picture = Me![ImagePath]
End If

Exit_Form_Current:
Exit Sub

Err_Form_Current:
Select Case Err.Number
Case 2220
'ignore the Can't Load Image error
Case Else
MsgBox ("Error # " & Str(Err.Number) & " was generated by " &
Err.Source & Chr(13) & Err.Description)
Resume Exit_Form_Current
End Select

End Sub

The image takes a second or two to load. A dialog is put on screen too.
This process can get very annoying after a while because it happens every
time the user navigates to another record.

From Tony Toews' web site: http://www.granite.ab.ca/access/imagehandling.htm
Getting tired of seeing that Loading Image dialogue flicker? Getting errors
by users who click on things before this is finished displaying? Try
creating/changing the following registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\Shared
Tools\GraphicsFilters\Import\JPEG\Options
ShowProgressDialog to No

I use the Tab control to "hide" the image on a different "page".
I also move the code to the OnGotFocus event of the ImagePath text box
which is on the next page of the Tab control.
This way, the only time the picture loads is when the user clicks the tab to
see it.

--
Joe Fallon
Access MVP



"Brook" wrote in message
...
Hi All,

I run a custom design business and what I am trying to
accomplish is this: I would like to be able to add
images/pictures in my database that I would be able to
view in a form. I am setting up a form to where, if I
click on a button (i.e. Pic 1) Pic 1 from my database
would show up in a image box on my form. Does anyone have
any ideas on how this can be accomplished?

Thanks,

Brook



  #3  
Old July 27th, 2004, 05:07 AM
Brook
external usenet poster
 
Posts: n/a
Default how to add images to a database to view in a form

Joe,

thank you so much for your help.. This sounds exactly
like what I would like to do.... Thank you!

Brook

-----Original Message-----
If you are interested in storing the picture in the

database check out
Stephen Lebans' web site:
http://www.lebans.com/loadsavejpeg.htm

The approved solution is to store the path and display

the picture
dynamically.
How to Link a Picture to a Form:

Use an unbound image frame named: ImageFrame
and add a field to your table called ImagePath.

To add the picture to a report just use code like this in

the On Format
event of the Detail Section.

Private Sub Detail_Format(Cancel As Integer, FormatCount

As Integer)
Me![ImageFrame].Picture = Me![ImagePath]
End Sub

In the OnCurrent event of the form use this code:

Private Sub Form_Current()
On Error GoTo Err_Form_Current

If IsNull(Me![ImagePath]) Then
Me![ImageFrame].Picture = "c:\msaccess.jpg"
Else
Me![ImageFrame].Picture = Me![ImagePath]
End If

Exit_Form_Current:
Exit Sub

Err_Form_Current:
Select Case Err.Number
Case 2220
'ignore the Can't Load Image error
Case Else
MsgBox ("Error # " & Str(Err.Number) & " was

generated by " &
Err.Source & Chr(13) & Err.Description)
Resume Exit_Form_Current
End Select

End Sub

The image takes a second or two to load. A dialog is put

on screen too.
This process can get very annoying after a while because

it happens every
time the user navigates to another record.

From Tony Toews' web site:

http://www.granite.ab.ca/access/imagehandling.htm
Getting tired of seeing that Loading Image dialogue

flicker? Getting errors
by users who click on things before this is finished

displaying? Try
creating/changing the following registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\Shared
Tools\GraphicsFilters\Import\JPEG\Options
ShowProgressDialog to No

I use the Tab control to "hide" the image on a

different "page".
I also move the code to the OnGotFocus event of the

ImagePath text box
which is on the next page of the Tab control.
This way, the only time the picture loads is when the

user clicks the tab to
see it.

--
Joe Fallon
Access MVP



"Brook" wrote in

message
...
Hi All,

I run a custom design business and what I am trying

to
accomplish is this: I would like to be able to add
images/pictures in my database that I would be able to
view in a form. I am setting up a form to where, if I
click on a button (i.e. Pic 1) Pic 1 from my database
would show up in a image box on my form. Does anyone

have
any ideas on how this can be accomplished?

Thanks,

Brook



.

  #4  
Old July 27th, 2004, 06:16 AM
Larry Linson
external usenet poster
 
Posts: n/a
Default how to add images to a database to view in a form

"Brook" wrote

I run a custom design business and what I am trying to
accomplish is this: I would like to be able to add
images/pictures in my database that I would be able to
view in a form. . . .


The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zip is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching Records Melissa Lambino New Users 6 July 20th, 2004 04:51 AM
How to show image in the form or report? JJ General Discussion 1 June 29th, 2004 06:01 AM
synchronizing form and list box Deb Smith Using Forms 8 June 21st, 2004 08:15 PM
how to start a form in datasheet view from the switchboard William Wenjie Wang New Users 3 June 1st, 2004 04:30 AM


All times are GMT +1. The time now is 03:04 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.