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
|
|||
|
|||
checking a field in a form before update
In an existing form that shows teacher details, there is a field for the
teacher id number (similar to a social security number). This field is shown in a text box but until now has never been checked for validity. From now on, if anyone wants to update this id number, a script will check the number. If it is not valid, there should be an error message displayed and, if the user wants to correct the field, the form should remain open with the cursor pointing to the field. In the BeforeUpdate of the form, I can use a message reponse box. If the user wants to update the field, how do I make sure that the cursor remains in the text box and the user cannot exit the form? Thanks. Leah -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200911/1 |
#2
|
|||
|
|||
checking a field in a form before update
hi Leah,
leahf via AccessMonster.com wrote: In the BeforeUpdate of the form, I can use a message reponse box. If the user wants to update the field, how do I make sure that the cursor remains in the text box and the user cannot exit the form? Use txtTeacherId.SetFocus in the Before Update event to set the focus into your text box. Also set Cancel = True if the ID is not valid. This will automatically raise an error message when the user tries to exit the form with an unsaved recordset. mfG -- stefan -- |
#3
|
|||
|
|||
checking a field in a form before update
Hi Stefan,
I had tried that. Let me try to explain: The form is defined to automatically update the information upon exiting the form (rather than have buttons for update or exit without saving). What I tried to do is to check the id Number on the BeforeUpdate of the form. If it is not correct I have a ResponseMessage. If the user does not want to change anything, I have cancel = true, exit and the data remains as it was. If the user does want to go back to change the id number, I wanted to setFocus to the field and let it "sit there". However, it exits the whole form (saving the new data if cancel=true is not in the script, or restoring the original data if cancel=true is in the script). What I think is happening, is that when it leaves the BeforeUpdate form event, it continues the cycle and exits. I am trying to stop that cycle. Thanks. Leah Stefan Hoffmann wrote: hi Leah, In the BeforeUpdate of the form, I can use a message reponse box. If the user wants to update the field, how do I make sure that the cursor remains in the text box and the user cannot exit the form? Use txtTeacherId.SetFocus in the Before Update event to set the focus into your text box. Also set Cancel = True if the ID is not valid. This will automatically raise an error message when the user tries to exit the form with an unsaved recordset. mfG -- stefan -- -- Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
checking a field in a form before update
Hi Stefan,
I just switched the checking of the field on the BeforeUpdate of the text box instead of the form, and everything seems to be working. Thanks for your help. Leah Stefan Hoffmann wrote: hi Leah, In the BeforeUpdate of the form, I can use a message reponse box. If the user wants to update the field, how do I make sure that the cursor remains in the text box and the user cannot exit the form? Use txtTeacherId.SetFocus in the Before Update event to set the focus into your text box. Also set Cancel = True if the ID is not valid. This will automatically raise an error message when the user tries to exit the form with an unsaved recordset. mfG -- stefan -- -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|