Click to add picture button...

andy_dyer

Registered User.
Local time
Today, 22:23
Joined
Jul 2, 2003
Messages
806
Hi,

I have been tasked with creating a database that can hold invoice details and also a scanned image of the invoice.

The images will be linked to the database and not embedded as to save space.

I have got a rather rough looking start from:

http://www.candace-tripp.com/access_downloads.htm

and selecting "picture in database"

This doesn't seem to allow to zoom in and out and when it comes to invoices it is no good if you cannot read it!!

Does anyone have any ideas how can I have the facility to have pictures displayed with their record with a zoom in/out facility?
 
andy_d
I have had most difficulty with images in Access. Embedding is not the way to go. Access can increase the file size of your original image by 3X... If you can use an icon that links the picture to your db, that can work for you. I think using PDF will give you a greater flexibility with the zooming feature you desire.

hope this helps.

and here's a site i've used in the past for reference
http://www.granite.ab.ca/access/imagehandling.htm
 
Ok, so I'm definitely not embedding my images!

Still stuck on zooming in and out tho!!

I have in another database a snapshot viewer control that allows zooming in and out, but this works from reports and clicking a button to run the report.

I need this to automatically display the image for each record as it is displayed.

Can the snapshot viewer control be used in this way?
 
Not sure if this works with unbound images


Option Compare Database
Option Explicit

Private Sub CmdBig_Click()
'Me![FormSub].Form![FormSubSub].Form![Image2]
Dim intWidth As Integer
Dim intHeight As Integer

With Me![FormSub].Form![formsubsub].Form![Image2]
intWidth = .Width
intHeight = .Height

.Width = intWidth * 1.05
.Height = intHeight * 1.05
.SizeMode = acOLESizeZoom
End With
' Allow Access time to Repaint Screen
' since we have Autorepeat set to TRUE for
' this Command Button
DoEvents

End Sub

Private Sub CmdSmall_Click()
'Me![FormSub].Form![FormSubSub].Form![Image2]
Dim intWidth As Integer
Dim intHeight As Integer

With Me![FormSub].Form![formsubsub].Form![Image2]
intWidth = .Width
intHeight = .Height

.Width = intWidth / 1.05
.Height = intHeight / 1.05
.SizeMode = acOLESizeZoom
End With

' Allow Access time to Repaint Screen
' since we have Autorepeat set to TRUE for
' this Command Button
DoEvents
End Sub


S.Lebans
 
Thanks Rich!

Trying not to appear thick...

My form is called frmPicture and my Image box is called Picture

I am trying to fit this into the code

With Me![FormSub].Form![formsubsub].Form![Image2]

As so far...

With Me![Forms]![frmPicture]![Picture]

With no success!! can you help my put my code right??
 
Ok...

Got that bit fixed!!

The next problem was that it was zooming in on just the top left corner!! I fixed this by putting the picture in a subform and giving this subform scroll bars so that i can view all of the picture!

My problem(s) now that i cannot fix and hopefully someone else can;

1) When I try to add a new record and add a picture to it straight away because that form and subform are linked by imgID the primary key (in order to get the right image to display at the right time) it causes a conflict as it thinks that they are both trying to create a new record with the same autonumber!! I need to create the record then exit and then come back and select the picture!! Is there a way around this?

2) When I place in the txtPicture field the name of the image I want displayed then it doesn't display straight away, I need to exit the form and go back in in order to get it to display. Likewise if I change the image it keeps displaying the old image until I exit and then re open the form. Is there a way arounf this?

3) When the form opens a small progress bar appears as the picture is placed, this progress bar appears two or three times and delays actually being able to anything with the record until it is quite finished. Any ideas why this is doing this?

I will try and get a copy of the database available to anyone willing to help!!
 
Please Help!!!!!

This is it so far!!

Including all my attempts at using an update query to update the tabel and refresh the image....
 

Attachments

Last edited:
Still stuck... anyone with any suggestions for anyone of the three problems???

I can do this piece meal if it helps anyone to help me!!!

:confused: :(
 
Things to think about

I don't have time to look at your code, but we created a similar db, except with Vendor/Product images. We also used a subform on the mainform. A couple of things to think about.

1. Make an "Add Image" form where the source is the same table as your subform, on closing this form, requery the subform on the main form. I would do this rather than an update query, in our case, we can have multiple images for one item (your invoice).

2. From this list, they highlight it and press a "glasses" button to view. I do this to prevent Access crashes. There are multiple posts on images causing Access to crash, as well as on the MSKB. You may not have a problem if you are only viewing one image/record.

3. I would definitely follow the advice I think was given about not embedding the image, but have a directory where these images are stored. We copy the original image to a known directory where it is renamed to the PK with extension, then give the user the option of deleting the original.

Hope this helps. if not let me know.

Rube
 
Thank you sooooooo much Oldsoftboss!!

My apologies for not responding sooner to your help as I have been off sunning myself on my hols!!

:D

That is amazing and almost EXACTLY what i needed!!

My only question is how do i add a brand new record?

The previous and next buttons only llow me to move around the existing records...

I have created a macro (v. quickly) just to see how it would work if I opened the main form in add mode...

An error message pops up about No Current Record before allowing me a blank form to complete?

Is there something set somewhere that prevents or hinders this and causes the message?

I need an easy way to add new records as well as editing the existing records...

Any suggestions??

:confused:
 
New Form

Instead of opening the form in the add mode, with the associated code, an easy way to do this would be to build a new form, and open it in the "Add Mode".

It just has to provide a new Primary Key, Title, and image path (depending on your table/form). If there are many images for one item, then almost the same thing applies, except you feed the PK to the image items (one/many).

The OldSoftBoss' example is a good one, with his you could just create a simple form in the "Add Mode" like the image example, referenced to his ItemID, Description, and PicFile.

I include a cancel, in case the user doesn't want to add the picture, to clean a "Dirty" form.

Also, I would make a button to view the picture, rather than automatically viewing the image. While this is not as "fluid" as the other way, it will help to prevent crashes. If you choose next/previous too quickly, it will crash Access. This is a known issue with Access. We originally had one of our Apps this way, then changed it to make the user hit a glasses command button to view the image.

Hope this helps.
 

Attachments

  • image.jpg
    image.jpg
    44.9 KB · Views: 231
Thanks Rube,

On looking closer at the database it was the previous and next buttons and their code that was causing the problems.

I have now amended the code so that it reacts differently to new records and to that of existing records and it all works fine.

Thanks again Oldsoftboss for an amazing example that fixed almost all of the porblems I was having!!

:D
 

Users who are viewing this thread

Back
Top Bottom