Setting Focus on a Control

kidzmom3

Member
Local time
Today, 01:25
Joined
Jan 25, 2002
Messages
39
I have a control on a form that needs to increment to the next available number on a new record. I have code in the event GotFocus and this works, except only when I click on the control or shift+tab back to it. I've checked my tab order (the control is first) and when a new record is started that is where the cursor is but simply tabbing to the next control isn't updating the previous control. It only does it when I either click on it or shift+tab back to it. I wanted this control to display the incremented number immediately upon a new record. Any suggestions

:confused:
 
Is the field a primary key?

Kidzmom,

Is the field you are trying to update a primary key field? Is it set to autonumber for a datatype?

Dennis
 
It is one field of 3 that is the primary key, and no it's not auto numbered because I need to have for example multiple no. 1 but under different dates (one of the other parts of the key).
 
don't know if this will work...how about putting the code in LostFocus? That way when you leave the field it will update...as I said, not sure about this. I'll look into it some more.
 
Thanks a bunch Dennis! That works much better! If you find out any more about getting it to happen immediately upon displaying the new record, that's the ultimate way I'd like to have it! Thanks so much for this forum!!!!!:D
 
have you tried using the me.refresh command tagged onto the end of your code?
 
:( Me.Requery causes the field to not do any updating to the next record. The more I've been thinking about this, I think it has to do with the multiple primary keys. I'm going to do some experimenting with the autonumber key in conjunction with something like the date as the key also and see what happens. I'll let you all know! If you think of anything else, please post it!:)
 

Users who are viewing this thread

Back
Top Bottom