which event to use for on goto different record?

  • Thread starter Thread starter Dan Kean
  • Start date Start date
D

Dan Kean

Hi all

I've got a form loading the path to a picture for each record, I can get the
picture to change on onclick or onfocus etc but how do I make it change the
picture when you goto the next record on the form, at present using onfocus
only if the path text box is selected it will change

Any Ideas?

Thanx
Dan
 
I don't have that as an option :S which property do you have that ability
for form/textbox?
 
Dan said:
I don't have that as an option :S which property do you have that
ability for form/textbox?

In the "Events" tab for the form, "Current" is the very first one.
 
Hi, this isn't working for me as it seems to try to load the picture from
the path in a textbox before the textbox reads from the record, how do I get
round this?
 
Dan said:
Hi, this isn't working for me as it seems to try to load the picture
from the path in a textbox before the textbox reads from the record,
how do I get round this?

I've used that method many times and never had any trouble. Have you tried
stepping through the code to see what is happening? All values in the record
*should* be available in the Current event. It would be pretty useless
otherwise.
 
Hi, this isn't working for me as it seems to try to load the picture from
the path in a textbox before the textbox reads from the record, how do I get
round this?

Hi -

Does the text in the textbox change after you change records? If it does,
the AfterUpdate Event for the textbox might work, no? Good luck.

--chris
 
Dan,


Create a table , call it tblImages

Three fields;

1) ImagesID (AutoNumber) PK
2) ImagePathName ' This hold the path and name of your image e.g
C:\AccessImages\Dog1.jpg
3) ImageDescription ' This is a simple description of your image e.g Me Dog
Fill the table with 2 or 3 lots of data

Make a form using the Form Wizard, Select Columnar (it is the default)

In Default View add Image Frame using Toolbox , when it wants you to select
an image use anything on the hard disk.

For this exercise change the image frame name to Image7
Change Picture type from embedded to linked
Change Size Mode to Zoom
Now copy the code below to the On Current of the form. (Douglas is correct,
you must use the On Current Event of your form.)
After you have copied the code, go back to the Image frame and delete the
path in your Picture ( this is the one that the image required when you
first started to insert the image frame) and replace it with this (none) yes
you use the ( ).

Save your form, open it and enjoy.



Regards,


John A

===============CODE=====================STARTS HERE=========================

Dim strNoPic As String


strNoPic = "C:\AccessImages\NP.jpg" ' This is a path of a picture to use
when you are on a new record, Mine is a ? from clip art.


If Me.NewRecord = True Then

Me.Image7.Picture = strNoPic 'When it is a new record then the
default will display


Else

Me.Image7.Picture = Me.ImagePathName ' This is the name of the bound
text box on your form.

End If

===============CODE=====================ENDS HERE=========================
 
Back
Top