If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
form event properties
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. |
#2
|
|||
|
|||
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 "J@50N-5ALTR" wrote in message ... 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. |
#3
|
|||
|
|||
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 "tina" wrote: 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 "J@50N-5ALTR" wrote in message ... 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. |
#4
|
|||
|
|||
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" wrote in message news 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 "tina" wrote: 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 "J@50N-5ALTR" wrote in message ... 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. |
#5
|
|||
|
|||
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" wrote: 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" wrote in message news 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 "tina" wrote: 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 "J@50N-5ALTR" wrote in message ... 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. |
#6
|
|||
|
|||
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" wrote in message ... 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" wrote: 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" wrote in message news 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 "tina" wrote: 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 "J@50N-5ALTR" wrote in message ... 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. |
#7
|
|||
|
|||
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*. |
#8
|
|||
|
|||
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 "J@50N-5ALTR" wrote in message ... 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*. |
#9
|
|||
|
|||
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. "tina" wrote: 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 "J@50N-5ALTR" wrote in message ... 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*. |
#10
|
|||
|
|||
are you printing the report by clicking a command button on the form, that
has code behind it? if so, add the same "SetFocus" line of code to the command button's procedure, after the OpenReport action. hth "J@50N-5ALTR" wrote in message ... 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. "tina" wrote: 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 "J@50N-5ALTR" wrote in message ... 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*. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Requerying a pop up form to display in the main form | Jennifer P | Using Forms | 13 | April 5th, 2005 06:59 PM |
Design help, please | SillySally | Using Forms | 27 | March 6th, 2005 04:11 AM |
Cursor Positioning | Colin Hammond | General Discussion | 3 | November 2nd, 2004 08:42 PM |
auto entry into second table after update | Tony | New Users | 13 | July 9th, 2004 10:42 PM |
synchronizing form and list box | Deb Smith | Using Forms | 8 | June 21st, 2004 08:15 PM |