4.0.2 db in 5.5, expandable TESOs don't expand, Print This Record tool bar item prints all records
Gary Yonaites
gary at yonaites.com
Sun Mar 16 08:49:50 PDT 2008
On Mar 15, 2008, at 6:26 AM, Steve Kane wrote:
> Hmmm. It looks like every form is corrupted. This is turning out to
> be far more tedious than I had thought. There does not seem to be a
> way of automating it. I can use GraphicsMode in a procedure but can't
> do anything else after that. Is there a way to automate this?
I found this to be a rather fun challenge. I worked out a method that
will walk through and copy all items from every form onto a new form
one at a time until every form is duplicated. You will need to enter
a new form name for each form as it is created and duplicated and
then you will have to go through and delete the old forms and rename
your newly created forms back to what the original names were. The
method requires two new procedures that I have named DupForms/8 and
DupForms/9. The only import part of the name is the /8 and /9
endings. Here is the code for each of the procedures:
*************DupForms/8*************
fileglobal formlist
define formlist,dbinfo("Forms","")
If formlist="" beep beep stop endif
OpenForm array(formlist,1,¶)
formlist=arrayrange(formlist,2,arraysize(formlist,¶),¶)
Key "command","ACW9"
GraphicsMode
***********DupForms/9***************
Key "command","VW8"
SetWindow 50,50,200,200,""
NewForm
Start by having only the data sheet open. By running the first
procedure DupForms/8, you start a loop of the two procedures that
will continue until all the forms have been duplicated. With the
first 5 lines we are getting a list of all the forms and then opening
each one in turn and removing it from the list. The magic happens in
the last lines by taking advantage of the way the Key command works.
All requested keystrokes will happen after the the rest of the
procedure is finished. Therefore, GraphicsMode will be executed first
to put the form in graphics mode and then the 4 keystrokes will be
executed and will not cause an error even though the front form is in
graphics mode. The first keystroke "command-A" selects all objects on
the form and the second key "command-C" copies them to the clipboard.
The third key "command-W' closes the form and the final key
"command-9" runs the DupForms/9 procedure.
The same magic happens in the DupForms/9 procedure in that the
SetWindow and NewForm commands will be executed before the Key
command. I use the SetWindow command to keep the new form window
small when opened so to paste the group of new objects in the far top
left of the new form. When the NewForm command executes you will have
to enter a temporary name for the form that you will have to manually
change later. In my tests I was just naming each form in succession
"1", "2", "3" etc.. After the new form is named and opened the Key
command will now execute. The first keystroke "command-V' pastes all
the objects into the new form. The second key "command-W" closes the
form and the last key "command-8" goes back and runs the original
procedure DupForms/8 once again for the next form. This loop will
continue until all the forms are duplicated.
You might wonder why this couldn't all be handled in one procedure.
The problem is that in one procedure even using the ExecuteASAP
method, the NewForm command will try to be executed while the
original form is still in graphics mode and generate an error. By
having the final keystroke of the Key command start the next
procedure after the original form is closed, we overcome that
problem. Of course you would want to try this on a backup copy just
to be safe. Not the complete automation requested but as close as I
can come on a Sunday morning.
Gary
gary at yonaites.com
More information about the Qna
mailing list