Change the positions of controls on preview ?

  • Thread starter Savvoulidis Iordanis
  • Start date
S

Savvoulidis Iordanis

How can I change the positions of controls on reports that are on preview
state ?

I want to do that, so that the new positions are saved on db (and retrieved
back on format/print events) for reports that need to be changed by the user
him/herself. I wouldn't like to send new versions of the program for these
kind of changes, to the users (I give a MDE file to the users)

TIA
 
M

Marshall Barton

Savvoulidis said:
How can I change the positions of controls on reports that are on preview
state ?

I want to do that, so that the new positions are saved on db (and retrieved
back on format/print events) for reports that need to be changed by the user
him/herself. I wouldn't like to send new versions of the program for these
kind of changes, to the users (I give a MDE file to the users)


You can use the Format event of the section containing the
controls to change the control's Left and Top properties.

Considering that a report is a static display with no input
mechanism, how do you propose to let the users specify the
controls' desired position and how are you going to prevent
them from specifying positions outside the report's print
area?
 
S

Savvoulidis Iordanis

Thanks for the reply.

Well, I have created a form that loads all the controls (or those that I
need) from the database, after I have exported all the properties I need
(form name, control name, left, top, width, height). Then, using that form,
the user can move/resize the controls as he wishes. This works, but only
when the report is in design mode. I really need it in preview, because,
the printout will be on preprinted paper (receipt) so the user has to deal
with the exact positions on that paper, and not me.

I;m looking forward to reading more ideas on this (if Access let us do it of
course)

TIA
Savvoulidis Iordanis
Greece
 
M

Marshall Barton

Savvoulidis said:
Well, I have created a form that loads all the controls (or those that I
need) from the database, after I have exported all the properties I need
(form name, control name, left, top, width, height). Then, using that form,
the user can move/resize the controls as he wishes. This works, but only
when the report is in design mode. I really need it in preview, because,
the printout will be on preprinted paper (receipt) so the user has to deal
with the exact positions on that paper, and not me.


You defintely do not want users operating in design mode.

As I said before, you can do this at run time using code
within the report. As long as you have a table that
identifies the report and each control along with the
desired positional info, you can do this in the Format event
of the section containing the controls OR if the settings
apply to entire report (as opposed to each detail), use the
report's Open event procedure.

Open a recordset on the table containing the settings,
filtering it to the report name. Then loop through the
recordset, manipulating the control properties. Since
setting the properties is not being done in design view,
these settings will not be save in the report, but they will
be applied each time the report is opened (i.e. makes no
effective difference).

I still think this is the easy part. I don't understand
what you are describing about the form, but I think getting
the users to use the form to set the properties in a sane
way, is the difficult aspect of your problem.
 
D

Duane Hookom

The Corp Tech Demos has a sample form where you can drag a control around in
form view (not design view). When you let go of the control, the top and
left values are stored in a table. I suppose you could use similar code to
move and resize several controls. Corp Tech Demos is at
http://www.invisibleinc.com/divFiles.cfm?divDivID=4.
 
S

Savvoulidis Iordanis

Thanks for the reply M. Barton.
All the things you describe, already done but want the users to actually
see what they actually moving. That's why I use the popup form with the
positional info.
After the user clicks on an arrow to move the column around (only in the
same section of course) in the report previewed, I want the column to move
before his/her eyes, not only check it out on the next preview/print.

Is seems Access does not show changes done after the report goes on preview.
It would untie my hands if it did
 
M

Marshall Barton

Savvoulidis said:
Thanks for the reply M. Barton.
All the things you describe, already done but want the users to actually
see what they actually moving. That's why I use the popup form with the
positional info.
After the user clicks on an arrow to move the column around (only in the
same section of course) in the report previewed, I want the column to move
before his/her eyes, not only check it out on the next preview/print.

Is seems Access does not show changes done after the report goes on preview.
It would untie my hands if it did


As I said before, a report preview is just a screen
representation of the paper you'd get by printing the
report. You wouldn't expect to be able to move columns
around on the paper, would you?

You can do that sort of thing with a form, but then you
wouldn't want to print a form either.

I guess my bottom line is that you're not likely to make
this as easy for the users as want to.

I haven't looked a Duane's example, but it might give you
some ideas to pursue.
 
D

Duane Hookom

Something similar to my solution would allow the user to move a control
around. There could also be code to resize the control. The dimensions and
size would need to be updated in a table of control properties. These could
then be used to resize and position controls on a report.

As Marsh suggests, this is not a walk-in-the-park.
 
S

Savvoulidis Iordanis

Well, not all things should be done by simple users. But those who have
admin rights could get a lot of burden off the programmers hands, don't you
think? The column movement could be allowed only to users with certain
rights.

I' m downloading the Duane's solution to check it out, and I' be back soon

Thank you all...
 
D

Duane Hookom

A report doesn't have any user interaction events. That is why I suggested
you do all of this with a form and save the postions and sizes in a table.
Then, when you open a report, use the values from the table to move and
resize the controls on the report.
 

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