Using Form record Selectors

Just post you database.
 
Here is how you save the path and use a image control. No code to render images.
 

Attachments

Before adding that image control, would that lose me the drag/resize behaviour I have at the moment ?
I'd still like to find how to pick up the record selector click on the Form I have now.
 
The confusion may be that you are calling the navigation buttons the record selectors. The record selectors are boxes next to the numbers with the
>and *

In a single form view you do not normally have a record selector. If you want a click event then put that on the image control itself or some button on the form.

dropdown2.jpg
 
So I looked at your form. As I already stated you can click in blank space or a record selector. Since you do not have record selectors you can click in blank space. If you want the code to happen every time you change records use the on current event. If you want to click anywhere on the form including the image then add the image click event. So exactly what is the problem? Not sure I understand, what is not working.
 
Ah, Jeez sorry - no wonder I was getting nowhere. Yes, Navigation buttons... and your db has been very helpful. So it is true the say an event when clicking Navigation buttons will only fire if there is a bound control on the Form ?
I don't want a control (at the moment anyway) rather just the Forms picture property. If I make your text box invisible I get the result I've been after and can Msgbox each Nav click in Form_current. Brilliant :)
Other refinements can follow.. e.g. your pathing suggestions.
Very happy this end. Thanks
 
Clicking on the navigation button does not cause any events. But by selecting the navigation button the form will move to the next record causing the on current to happen. This will not work if you get to the last or first record since you will not move. You may want to roll your own navigation buttons for more control
Then you can capture the clicks on these.
I am still not sure I understand what you are looking for. I do recommend storing the path separately, or you really limit your ability to move the files without changing all the paths. I also recommend the bound image control. A lot of people do not know about it and it really simplifies a lot of code. I you are talking a small amount of files the attachment control also works well and then you are even more portable. In the old days any image blew up the size of the DB. The attachment format is far less overhead.,
 
I still could not (even after duplicating your frmPic) get Form_Current to work.
Anything there was ignored. It drove me batty. In the end I imported your frmPic, where Form_Current does work.

I have added tblApplicationSettings for Path, qryImages and stored the filenames in tblImages.
frmPic.Picture mode is set to Zoom. Text5 is visible= false and Control Source = FullPath

Code now is
Code:
Private Sub Form_Current()
    Me.Picture = Text5
End Sub

Private Sub Form_Load()
        DoCmd.MoveSize 6000, 3000, 10 * 1440, 8 * 1440
End Sub

This now does what's wanted and shows each picture on the Form as the Navigation buttons are used.
However is this likely to run into the bloat problem you mention? If yes maybe the image control is someting to add ?

One last question... your db opens with a Form showing but you have no autoexec macro. What's the secret there?
And needless to say, many thanks for all the advise. :)
The custon nav button was interesting, but would mean controls on the Form, this way that's off Form and all of it can be used by the image.
 
However is this likely to run into the bloat problem you mention? If yes maybe the image control is someting to add ?
No, not related. If you are saving just your path; however, you do it your database only grows by the text you save. So for each record that is basically nothing.

If you decide to store your pictures in an attachment field then your database grows much faster but only by the size of the image. If you store 20 mb of .jpg images it grows by 20 mb. That is not a big deal. Prior to 2007 there was no attachment field. If you wanted to store the image in the db you used an OLE field. You could only use .bmp which are big. So your same 20 mb of .jpg would likely be some much bigger number like 200 mb of .bmp. Then when you stored the 200 mb in the OLE field it stored additional data to allow you to see the images. The 200 mb would grow to 800 mb. So very quickly your database grows out of control.

Default form:

The custon nav button was interesting, but would mean controls on the Form, this way that's off Form and all of it can be used by the image.
If you wanted to use it, it would be the same, but might look nicer since you can format and size to your likings. You would turn or the current navigation buttons. Add a footer and put it in the footer of the form. Then put the image in the details and have it take up the detail section. The amount of real estate would be the same, but you could center it and make it look nicer.
 
This is with a custom navigation bar. I think it looks nicer and you can format to be larger too.
customNavigation.jpg
 
Last edited:
when you say record selector. do you mean the navigation buttons at the bottom, or the record selector arrowheads on the left.

note that when you click a record selector that shows as a pencil, it will save the record.

anyway, clicking a new record selector, effectively saves the old record, navigates to a different record, and runs the current event on the new record. Your code ought to refresh an image ought to go in the current event.
 
The record selector is intended to choose a record. It is not used to scroll through a recordset. If the form is bound to a recordset, it will have navigation controls on the bottom. THOSE are what you use to scroll.

You need to get the paths to the pictures loaded into a table OR, you can use an unbound form and have a control to pick a folder and then add buttons that you write code for to move back and forth through the pictures in the folder.

I see that MagP loaded a sample like what I described while I was typing.
 
Yes, I was incorrectly calling the Navigation control the "record selector"?
I also had some glitch in the Form where the On_Current event didn't work. With a second Form (or new one) it does work but I'd deleted the first so no way to see what might have been wrong. I didn't realise it was bugged, thought it was ok and there was some problem to fix.
MajP will play with Image control, sounds good.
 
MajP will play with Image control, sounds good.
To be clear the image control does not gain you all that much from what you already have. What is nice is that it does not require any code, it loads whatever is in the path. Both techniques are efficient in that you are not storing the file in the DB.
 
Agreed, it's working pretty good with just the Form. And I learned how to prevent adding another record via Nav control. (with a second table in the query). Ok on the Form load startup.. I'd actually looked there but didn't notice it. So I have a few redundant Autoexec macros now!
 

Users who are viewing this thread

Back
Top Bottom