form event properties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a small problem that occurs when printing a report. I use the find
file (CTRL+ F) feature to locate a file that I wish to print, and must have
the searchable field selected when I do this search. Once I have closed the
preview window of the report, I want the form to reset the cursor to the same
field as before. The cursor appears in none of the fields when I return to
the form. Is there an event property of the form that I can reset the cursor
position without selecting the field by hand?
I appreciate any guidance with this matter.
 
you might try adding code to the form's Activiate event procedure, as

Me!MyControlName.SetFocus

substitute the name of the control on your form.

hth
 
Hi tina,
I am a true neophyte when Visual Basic is concerned. If my form's name is
"mainEquipment Information" then how do I write the code that you gave me.
When I wrote the code an error said that the command "Private Sub
Form_Activate()" would stop the debugger, but I wrote it in the form's
Activate event procedure as you suggested. If I am off base, please point me
in the proper direction. Thanks
 
did you put the code in the [mainEquipment Information] form's event
*procedure* in the VBA Editor window? or did you put it right on the On
Activate property line in the Properties box of the form design view?
 
I did put the code in the [mainEquipment Information] form's event
*procedure* in the VBA Editor window but I accessed the event procedure
through the Properties box of the form design view. In short I selected the
Activate property line then chose *event procedure* from a drop-down menu. I
then clicked on the "..." button to access the VBA Editor window and there I
added your line of code. What do I need to do next?

tina said:
did you put the code in the [mainEquipment Information] form's event
*procedure* in the VBA Editor window? or did you put it right on the On
Activate property line in the Properties box of the form design view?


J@50N-5ALTR said:
Hi tina,
I am a true neophyte when Visual Basic is concerned. If my form's name is
"mainEquipment Information" then how do I write the code that you gave me.
When I wrote the code an error said that the command "Private Sub
Form_Activate()" would stop the debugger, but I wrote it in the form's
Activate event procedure as you suggested. If I am off base, please point me
in the proper direction. Thanks
 
well, you did it exactly right (i had to ask; sometimes folks unfamiliar
with VBA will put code right on the event line in the Properties box). as
for the error message,
When I wrote the code an error said that the command "Private Sub
Form_Activate()" would stop the debugger

i haven't a clue why you would get such an error message. did you get the
error message when you tried out your process with the code in place? if
not, run through your process and see if the Activate code provides the
result you want. if it doesn't, maybe we can come up with another solution.

hth


J@50N-5ALTR said:
I did put the code in the [mainEquipment Information] form's event
*procedure* in the VBA Editor window but I accessed the event procedure
through the Properties box of the form design view. In short I selected the
Activate property line then chose *event procedure* from a drop-down menu. I
then clicked on the "..." button to access the VBA Editor window and there I
added your line of code. What do I need to do next?

tina said:
did you put the code in the [mainEquipment Information] form's event
*procedure* in the VBA Editor window? or did you put it right on the On
Activate property line in the Properties box of the form design view?


J@50N-5ALTR said:
Hi tina,
I am a true neophyte when Visual Basic is concerned. If my form's name is
"mainEquipment Information" then how do I write the code that you gave me.
When I wrote the code an error said that the command "Private Sub
Form_Activate()" would stop the debugger, but I wrote it in the form's
Activate event procedure as you suggested. If I am off base, please
point
me
in the proper direction. Thanks

:

you might try adding code to the form's Activiate event procedure, as

Me!MyControlName.SetFocus

substitute the name of the control on your form.

hth


I have a small problem that occurs when printing a report. I use
the
find
file (CTRL+ F) feature to locate a file that I wish to print, and must
have
the searchable field selected when I do this search. Once I have closed
the
preview window of the report, I want the form to reset the cursor
to
the
same
field as before. The cursor appears in none of the fields when I return to
the form. Is there an event property of the form that I can reset the
cursor
position without selecting the field by hand?
I appreciate any guidance with this matter.
 
Tina,
Thanks for all your help; my understanding of VB is a bit more substantial.
If any one else might have some insight about how this command "Private Sub
Form_Activate()" will stop the debugger" could be corrected it would help
matters so much. The command line turned yellow with a yellow arrow next to
it, if that will shed some light on matters. I also need to know where to add
the form's name *Form_Equipment_Information* to the Activate command
*Me!MyControlName.SetFocus*.
 
you're putting the code in the module of form *Form_Equipment_Information*.
so the Me keyword refers to that form - you don't need to refer to it
explicitly. substitute the name of an actual control on your form, in place
of MyControlName.

hth
 
Great news, the form resets the cursor to the field that I wish once I close
the preview window to activate the form window. I don't get the same effect
when I print a report since no preview window opens. How do I reset the
cursor to the desired field while the form is still active? Thanks for the
help.
 
Back
Top