capture the event (test property) when the user prints a report

  • Thread starter Thread starter nikolaos
  • Start date Start date
N

nikolaos

hi there folks!!!!


i have an important question to ask but i have to give
you a large amount of feedaback first so please bear with
me.

i am working on a micrsoft office certification project
not run by microsoft.


basically you have to know all the microsoft object model.

i am working in athens and i am a web developer and an
applications developer.


you have heard of ECDL i imagine. it is an organisation
that provides certification of different levels for
microsoft office products to people who take its exams.


so basically my team and i have built an application that
allows the user to take the test.

i have finished word,excel and powerpoint. now i am
working with access.

access unfortunately does not have a macro recorder so
here i have a problem.


so the user sits in front of the computer and then clicks
on the .exe and the application fires up
the application. the user sees a screen and a question.

for example : question1 :

create a form from the table movies containing all the
fields of the table movies and save the form under the
name moviesform.


the user does whatever he thinks is right and then he
hits the button "answer".


after he finishes the test he is awarded marks to see if
he failed or passed the test. so basically is a computer
based test.

so besides building the application which fires up access
and questions i have to write scripts in VBA (macros)
that detect if the user has done what he is supposed to
do and give him a point or not.


for example i use something like this to test the active
form name.

Application.Screen.ActiveForm.Name

if Application.Screen.ActiveForm.Name <>"moviesform" then

msgbox "error"

end if

else

msgbox "ok"
end sub

as you imagine i can not use methods because if i use i
will complete the question not the user.

what i mean is this. if the user is asked to print the
first page of the active report the macro vba will look
like this.

Application.Screen.ActiveReport.Print acPages, 1, 1

but if this thing runs will print the first page of the
active report. so what i want is the user to do it
himself and then miself check a property that tells me if
the user has done so ro not.

i have completed most of the questions but i have a
problem with printing questions.


how can i check if the user has printed the first page of
an active form or of an active report?

appreciate any help.


nikos
 
Nikolados,

You will certainly have some twists and turns if your code
has to actually produce a grade for these folks and you are
asking them to perform tasks versus answering questions. A
couple of thoughts...

1) If you are grading someone on saving a form under a
certain name, you really should use universally accepted
Access/VBA naming conventions. The form should be named
"frmMovies" or "frm_Movies". No sense training them in bad
habits while they are testing.

2) Now what if the user creates the form and saves it like
you asked, but closed the form instead of letting it remain
open? Your Active.Form test would fail, besides which, it
will probably not be active anymore if he goes back to the
test interface.

3) What if they create the form, but only put on 4 out of 6
fields onto it? or they put none on? Does a blank form count
as much as a complete one? A sloppy form as much as a nice
one? One created with the wizard vs. being done from
scratch?

For your example, the best way for checking 1) is a form
there with the correct name? 2) Does it have the appropriate
number of controls of the correct type and name? would be to
open up the Forms Collection in VBA code and test for the
form existence. If it is there then you would probably want
to loop through the Controls collection and test for the
details that you need to verify.

As for your Print verification, I certainly know of no way
to verify which pages printed unless you are controlling the
whole printing process programatically which would defeat
the purpose.

One last thing. You will be almost stonewalled from the
getgo if you try and do all of this with Macros. I don't see
any way without handling it all in pretty custom VBA code
routines.

Interesting concept. Good Luck,

Gary Miller
Sisters, OR
 
What you are asking for is similar to the winhelp "training card" idea.

With winhelp training cards, you can write code which asks the user to do
something (eg. select a menu option), then that code can see if the user did
it, or not.

This works fine in a winhelp environment. However, I very much doubt that it
would be possible in the Access environment using VBA. If is was *very
restricted*, then maybe. (Eg. say to the user: "please add a textbox control
called 'blah' to your form, then click OK when you have done that".) But if
you want to let the user create a whole form (for example), then you want to
check if the user got it correct, and you want to do this for other objects
such as tables etc., then, this will be a *very big ask*. And I say that as
someone who has written at least 100,000 lines of Access VBA.

HTH,
TC
 
Back
Top