Mimicking a sub form in a continuous form

M

Michael T

I have a continuous form which lists photographs on the left hand side;
pretty straight forward: photo number, photo date, photo description etc.

What I would like to do is display the appropriate photo on the right hand
side of the screen when the cursor is in a photo number field row; I cannot
use a subform (Access won't let me). Using a popup form I can't work out how
to close it and re-open it (or perhaps not ope/close it but refresh it?)
when I move the cursor down the list of photos in the continuous form. I
have tried using events from the photo number field (e.g. get focus and lost
focus) to open and close the popup (using the open args to pass the photo
number) but I seem to have problems with the popup form then being stuck
with focus.

There must be a simple way :)

A second question is (assuming I do use a popup form) how do position it in
the same position to the right hand side of the screen rather than
defaulting to popping up in the middle?

Many thanks,

Michael.
 
B

Bill

I don't know how much room the photo number, photo date and
photo description require. If you have the bulk of the screen
available, my first thought is to have a form with an unbound
image control in the right side of your screen and a continuous
form sub-form positioned down the left side. When the form
opens, the first picture in the list is displayed on the right with
it's photo number field having the focus. When the user clicks
on a different photo number, your OnClick event re-links the
control source of the image control.
Bill
 
A

Albert D. Kallal

Yes, you can use a sub-form here.

The trick here is to NOT use a sub-sub form...

So, the "main" form can be based on the main
record. For the "many" photos for that one record, you
drop in a sub-form on the left side (a continues form).

If you set the child link/master records, then this
sub-form will populate correctly.

On the "right" side of the "main" for (to the right of this continues
list of pictures) to display your picture that is just going to be
a picture control...not a sub-form.

In the on-current event of the form that displays/lists the info about the
picture, you simply go:

me.parent.Image13.Picture = me.PathToPicture

It is assumed that you have a column that has the path name to the file.

Note that if you using access 2007, you can actually place a picture control
right in the continues form and see all of the pictures at once.

If you using pre 2007, then you have to use the above idea...

So, you CAN have "many to many" display by simply placing the sub-forms
beside each other on a main form and NOT try to use a sub-sub form. I have a
screen shot of such a screen here:

http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm

Scroll down to the VERY last screen. You see at the top is info about the
donations, on the left side is people who donated an amount, and on the
right side is their donation broken out into each account. This is a common
and classic type of data entry form used in accounting systems.

I used the above idea for that last form. On the right side I not displaying
a picture..but in fact another continues form. Thus you get a display of one
to many--->to many...
 
M

Michael

Albert,

I just loved your first two sentences. What a wonderufl wheeze: I shall try
it.

All the best,

Michael.
 
M

Michael

Thanks Bill,

I'll try this!

Michael.


Bill said:
I don't know how much room the photo number, photo date and
photo description require. If you have the bulk of the screen
available, my first thought is to have a form with an unbound
image control in the right side of your screen and a continuous
form sub-form positioned down the left side. When the form
opens, the first picture in the list is displayed on the right with
it's photo number field having the focus. When the user clicks
on a different photo number, your OnClick event re-links the
control source of the image control.
Bill
 
M

Mike Painter

Michael said:
I have a continuous form which lists photographs on the left hand
side; pretty straight forward: photo number, photo date, photo
description etc.
What I would like to do is display the appropriate photo on the right
hand side of the screen when the cursor is in a photo number field
row; I cannot use a subform (Access won't let me). Using a popup form
I can't work out how to close it and re-open it (or perhaps not
ope/close it but refresh it?) when I move the cursor down the list of
photos in the continuous form. I have tried using events from the
photo number field (e.g. get focus and lost focus) to open and close
the popup (using the open args to pass the photo number) but I seem
to have problems with the popup form then being stuck with focus.

There must be a simple way :)

A second question is (assuming I do use a popup form) how do position
it in the same position to the right hand side of the screen rather
than defaulting to popping up in the middle?
I have a form with pictures on the right and a good bit of information on
the left.
All the pictures are in a directory (D:\someplace\pictures) and the table
contains this link.
EG D:\someplace\pictures\WOW.gif
This code in the on current event in my case loads the picture.
If Nz(Me!pictureloc, 0) = 0 Then
Me!pictureloc = "d:\volpics\maltesecross.gif"
else
Me![Image24].Picture = Me![pictureloc]
end If
The Maltesecross is put up if there is no picture (volunteer fire
department)

If your subform uses Forms.MainForm.pictureloc it would load the picture as
you want with no need for a popup.

I have code that runs against the directory and loads the location of new
pictures into the main table. It "will not add duplicate since pictureloc
is indexed with no dupes".

This returns all file types which might be a problem if teh directory is not
all pictures.


Public Sub GetPictures()
On Error GoTo dupefound
'adds new picture links
'will not add duplicate since pictureloc is indexed with no dupes
Dim pictureLocation, PicLocation
Dim MyFile, MyPath, MyName
Dim dbsCurrent As Database
Dim rst As Recordset

' Set dbsCurrent = OpenDatabase("DB1.mdb")
Set dbsCurrent = CurrentDb()
Set rst = dbsCurrent.OpenRecordset("volunteers")

MyPath = "D:\volpics\*.*"

MyFile = Dir(MyPath)

MyName = Dir(MyPath) ' Retrieve the first entry.
Do While MyName <> "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If MyName <> "." And MyName <> ".." Then
With rst
.AddNew
!pictureloc = "d:\volpics\" & MyName
.Update
dupeskipped:
End With
End If
MyName = Dir ' Get next entry.
Loop
Exit Sub
dupefound:
If Err.Number = 3022 Then 'we already have this one.
'MsgBox Err.Number
Resume dupeskipped
End If
End Sub






If you load "NEW" or something into the table at the same time you can run a
query that will allow you to add information to the new pictures.
 

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