bug in code behind text box

jojo

Registered User.
Local time
Today, 15:01
Joined
Jul 20, 2012
Messages
51
I have a nasty bug on a form, and would be grateful for help. The last field on the form is a combo box. When the user enters data, and presses tab or enter, it goes right to a new blank record with focus on first blank field ready to enter new data. BUT if instead she goes to a different field, to fix or clicks elsewhere on the screen, it goes to a new record then, too, which it shouldn't! Serious problem for her, if she's taking orders over the phone and has to be fast. The code in that last field is just DoCmd.GoToRecord , , acNewRec, a 1-line event proc for the ON Exit event. Access 2010.
Any ideas would be helful.
Thank you.
JoJo
 
It's not really a bug, as the code is doing exactly what you have coded it to do.

You have put the code in the On Exit event of your Combo so whatever happens as soon as your user exits that Combo they will be taken to a New Record. I would consider removing that code from the On Exit event.

If your Combo is the last Tab Stop on the form as soon as your user tabs out of the combo the focus Should go the the first field of a New Record, assuming you have not prevented this with either the set up of your form or with Code.
 
Yes, thank you so much. I was just coming back to correct this; I realized that as I played around with it. (where is the embarrassed icon?)
I actually would like it to be the last tab stop, but it's only the last tab stop for data entry, then there are several command buttons, one of which is NewRecord. I really wanted it the way I had it, that after that last field was entered, the page turns to a new rec. But of course, if/when she needs to go back to one of the fields on the current record, it will never due to suddenly be looking at a new rec, as she is taking phone orders and has to be fast.
Is there any other approach?
Thank you for the quick and helpful answer!!
 
You could put the code in the Key Down event of the field and by pass it until the user hits the Tab key.
 
The code might look something like;
Code:
    If KeyAscii = vbKeyTab Then
        DoCmd.GoToRecord , , acNewRec
    End If
 
Thank you so so much! This forum is the best; I will try that and let her decide which is the better, more seamless approach.The web page is not letting me add to your reputation!
 

Users who are viewing this thread

Back
Top Bottom