Hi.
I'm trying to figure out the best place/way to put certain subroutines to update certain fields in my form. I have tried to find a good explanation of the different options (On Click, Before Update, After Update, On Exit, ...etc.) but I haven't found one that describes the nuances well enough for me to understand them.
The problem I'm running into is that the code runs fine when the field is updated manually - i.e. the person types in the field and then tabs to another field. I've put the code into the After Update.
For example - I want the Nickname to update after the Firstname is typed in. In the After Update I have the following code:
If IsNull(Me.Nickname) Then
Me.Nickname = Me.Firstname
End If
The problem is that I also have a parsing routine. When the parsing routine updates the name, the copy-to-nickname code doesn't run. I could copy the Firstname code into the parsing routine, but we are not just talking a single update - I've got dozens of these. I expected that they would run whether the field was updated manually or through another subroutine, and that's not happening. Should I be using On Change instead of After Update?
In other cases I want the code to run when the user tabs out of a field even if they didn't change anything. Would On Exit work, or does On Exit refer to exiting out of the entire form instead of just that one field?
Any help that you can give would be most appreciated.
Thanks
CJ Rhoads
I'm trying to figure out the best place/way to put certain subroutines to update certain fields in my form. I have tried to find a good explanation of the different options (On Click, Before Update, After Update, On Exit, ...etc.) but I haven't found one that describes the nuances well enough for me to understand them.
The problem I'm running into is that the code runs fine when the field is updated manually - i.e. the person types in the field and then tabs to another field. I've put the code into the After Update.
For example - I want the Nickname to update after the Firstname is typed in. In the After Update I have the following code:
If IsNull(Me.Nickname) Then
Me.Nickname = Me.Firstname
End If
The problem is that I also have a parsing routine. When the parsing routine updates the name, the copy-to-nickname code doesn't run. I could copy the Firstname code into the parsing routine, but we are not just talking a single update - I've got dozens of these. I expected that they would run whether the field was updated manually or through another subroutine, and that's not happening. Should I be using On Change instead of After Update?
In other cases I want the code to run when the user tabs out of a field even if they didn't change anything. Would On Exit work, or does On Exit refer to exiting out of the entire form instead of just that one field?
Any help that you can give would be most appreciated.
Thanks
CJ Rhoads
Last edited: