Simple Question
I am trying to write code so that I can trigger the after Update event in a form. I have done this fine with the coding below. It works perfectly for text boxes, combo boxes etc. However now I am trying to write the same type of simple code to set a check box to yes. I know it is something simple that I am not doing. I have minimal knowledge of code when it comes to thinking of it on my own. Any help would be great. Thanks!
Public Function SetNameCr_123456789()
Forms![DDA to DDA]![Cr DDA #].SetFocus
Forms![DDA to DDA]![Cr DDA #].Text = 123456789
End Function
Report this post to a moderator | IP: Logged
04-15-2003 11:45 AM
AlanS
Senior Member
Registered: Mar 2001
Location: Philadelphia, PA USA
Posts: 300
If you want to trigger an event procedure from code, you need to specifically call the appropriate procedure, for example:
If [some condition] Then MyTextBox_AfterUpdate
or
If [some condition] Then Form_Load
Note that changing a form or control via code will NOT automatically trigger the event procedure which would be automatically triggered if the same change had been made from the user interface.
If you want to turn a checkbox on, set its value to True or -1; to turn it off, set its value to False or 0; for example:
MyCheckBox = True
sorry I accidently deleted the thread, not sure what I was doing there. Where would I put this code and how exactly would I write it. I really have a hard time writing code.
I am trying to write code so that I can trigger the after Update event in a form. I have done this fine with the coding below. It works perfectly for text boxes, combo boxes etc. However now I am trying to write the same type of simple code to set a check box to yes. I know it is something simple that I am not doing. I have minimal knowledge of code when it comes to thinking of it on my own. Any help would be great. Thanks!
Public Function SetNameCr_123456789()
Forms![DDA to DDA]![Cr DDA #].SetFocus
Forms![DDA to DDA]![Cr DDA #].Text = 123456789
End Function
Report this post to a moderator | IP: Logged
04-15-2003 11:45 AM
AlanS
Senior Member
Registered: Mar 2001
Location: Philadelphia, PA USA
Posts: 300
If you want to trigger an event procedure from code, you need to specifically call the appropriate procedure, for example:
If [some condition] Then MyTextBox_AfterUpdate
or
If [some condition] Then Form_Load
Note that changing a form or control via code will NOT automatically trigger the event procedure which would be automatically triggered if the same change had been made from the user interface.
If you want to turn a checkbox on, set its value to True or -1; to turn it off, set its value to False or 0; for example:
MyCheckBox = True
sorry I accidently deleted the thread, not sure what I was doing there. Where would I put this code and how exactly would I write it. I really have a hard time writing code.