Picture now shown immediately

  • Thread starter Frank Situmorang
  • Start date
F

Frank Situmorang

Hello,

Thi is my VBA to change the image in my imageframe on the Main Menu. The
picture will show up when we close then we open.

I guess that there must be an VBA to be put in the current event. of the
form, but anyone can help me what it is?

Private Sub cmd_FindImage_Click()

Dim strPath1 As String

' get picked file path
strPath1 = GetOpenFile

' if there is something there
If Not (Len(strPath1 & "") = 0) Then
'set ImagePath1 equal to picked path
Me.txt_ImagePath1 = strPath1
End If

Exit_Handler:
Exit Sub

Err_Handler:
Select Case Err.Number
Case Else
Call ShowError(Err.Number, Err.Description, _
"Form_Defaults Form." & "cmd_FindImage_Click")
Resume Exit_Handler
End Select
End Sub

Thanks in advance
 
S

strive4peace

Hi Frank,

What version of Access are you using?

Warm Regards,
Crystal
remote programming and training

*
:) have an awesome day :)
*
~~~~~~
Learn Access on YouTube!
http://www.youtube.com/user/LearnAc...url]http://www.AccessMVP.com/strive4peace~~~~
 
F

Frank Situmorang

Hi Strive, I have Access 2002

Thanks for more explanation
--
H. Frank Situmorang


strive4peace said:
Hi Frank,

What version of Access are you using?

Warm Regards,
Crystal
remote programming and training

*
:) have an awesome day :)
*
~~~~~~
Learn Access on YouTube!
http://www.youtube.com/user/LearnAc...t End Sub Thanks in advance[/QUOTE] [/QUOTE]
 
S

strive4peace

Hi Frank,

I am a little oncfused why you are writing the path and filename to a
textbox control (assuming that is what it is from the controlname).

With an Image control, you set the PICTURE property to a path and
filename. since the picture does show up when you close and open the
form, you must have have code doing this and perhaps have not taken time
to understand ... so you do need to look at it.

To prepare yourself for better understanding of VBA, read this:

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

~~~

as for setting the Picture property yourself, it is easy --- once you
know the path and filename, do this:

me.Image_controlname.Picture = strPathFilename

WHERE
-Image_controlname is the Name property of your Image control
-strPathFilename is a variable (or control reference or literal value)
with a string containing the path and filename to your image


Warm Regards,
Crystal
remote programming and training

*
:) have an awesome day :)
*
~~~~~~
Learn Access on YouTube!
http://www.youtube.com/user/LearnAccessByCrystal
 
F

Frank Situmorang

Strive,

The picture shows up, when we close the form and open it. But what I want is
as we already chosed the pricure, it will simulatanously show up.

I need to tell you that the imagepath text control is in Default Form, while
the picture to showed up is in the 1st Menu/panel ( diffrenent form)

Thanks in advance
 
S

strive4peace

Hi Frank,

how is the Picture property for the Image being assigned? Are you
storing it in a table and then getting the value from the table? ... or
what?


Warm Regards,
Crystal
remote programming and training

*
:) have an awesome day :)
*
~~~~~~
Learn Access on YouTube!
http://www.youtube.com/user/LearnAc...url]http://www.AccessMVP.com/strive4peace~~~~
 
F

Frank Situmorang

Strive:

My picture property is this:
C:\Churchdata\Gr.Kby.JPG

But I make a button in the default form to change the picture they want to
have it in their manu. It works but we should exit the database first then we
open again, and we can see the picure is change.

Thanks for more help.
 
S

strive4peace

Hi Frank,

please post the code you are using, thank you

Warm Regards,
Crystal
remote programming and training

*
:) have an awesome day :)
*
~~~~~~
Learn Access on YouTube!
http://www.youtube.com/user/LearnAc...url]http://www.AccessMVP.com/strive4peace~~~~
 
L

Larry Linson

I am as puzzled as to what you are doing as is Crystal. Certainly, the code
you show does not, itself, set the Picture property of any Control to
display a picture. Rather than try to extract the details, and try to fix
code that I didn't create, I will direct you some examples that I created.
(Just a comment: we don't ask for additional information unless we need it
to assist you, and it is a really good idea to carefully read what we ask
for, and provide that, rather than give us some other information that you
think might be useful.)

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.

And, Stephen has an ActiveX control available that works in cases where the
graphics filters are not available -- and works better, I've heard, than the
OLE Object and OLE Controls.

Please note that there are other approaches, e.g.,
Application.FollowHyperlink, but those, like OLE and Bound OLE Frames still
leave you "at the mercy of the imaging software registered for the
filetype".

Finally, Access 2007 has enhancements that, reputedly, eliminate the
database bloat long associated with OLE Objects and Bound OLE Frames. But,
it still leaves you relying on the software registered for the image type,
which may not be as "cooperative" as we'd like in creating our display. It
also has the capability of having a variable number of Attachments to a
Record, which may be helpful. But, as I have not done much with it yet, I
certainly wouldn't suggest you rush out and replace an earlier version --
until you have a copy incorporating, at least, the first Service Pack, or
have the Service Pack in hand and ready to apply as soon as you install
Access 2007.

Larry Linson
Microsoft Office Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top