By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,165 Members | 1,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,165 IT Pros & Developers. It's quick & easy.

many controls

100+
P: 553
Hi,

If there are so many controls on a form - check boxes, radio buttons, texboxes, etc.

How can i know if any of these are changed - thier value changed, etc

If any of these is changed ... then do something.

Thanks
Jul 27 '07 #1
Share this Question
Share on Google+
7 Replies


P: 65
Right click on the item and add some code. Something like build... I think (in dutch is "gebeurtenis opbouwen")
Jul 27 '07 #2

100+
P: 553
Twanne

I said i have items not just a single item.

There are 10s of controls , how can you set onChange event or something with everyone ?

Ofcouse a better method is needed

Right click on the item and add some code. Something like build... I think (in dutch is "gebeurtenis opbouwen")
Jul 27 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
Is there one thing you want to do if any of the controls change, or are there different things you want to do, depending on which controls change?

Linq
Jul 27 '07 #4

100+
P: 553
I want to do one thing if any of the controls change

Is there one thing you want to do if any of the controls change, or are there different things you want to do, depending on which controls change?

Linq
Jul 27 '07 #5

missinglinq
Expert 2.5K+
P: 3,532
This will immediately run the code with the input of a single character into any field
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Dirty(Cancel As Integer)
  2.  'Code to run goes here
  3. End Sub
  4.  
This will run the code when the record is saved if a single character has been entered into any field
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.  'Code to run goes here
  3. End Sub
  4.  
If you only want the code to run when a record is being edited, not when a new record is being entered, use this code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.  If Not Me.NewRecord Then
  3.   'Code to run goes here
  4.  End If
  5. End Sub
  6.  
  7. Private Sub Form_Dirty(Cancel As Integer)
  8.  If Not Me.NewRecord Then
  9.   'Code to run goes here
  10.  End If
  11. End Sub
Linq
Jul 27 '07 #6

100+
P: 553
HI Linq

The code you have give works fine. What if i want to check other things like change of check-box value or radio button value?

If their value change then do something ......Again i have so many of these on the form.

Thanks

This will immediately run the code with the input of a single character into any field
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Dirty(Cancel As Integer)
  2.  'Code to run goes here
  3. End Sub
  4.  
This will run the code when the record is saved if a single character has been entered into any field
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.  'Code to run goes here
  3. End Sub
  4.  
If you only want the code to run when a record is being edited, not when a new record is being entered, use this code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.  If Not Me.NewRecord Then
  3.   'Code to run goes here
  4.  End If
  5. End Sub
  6.  
  7. Private Sub Form_Dirty(Cancel As Integer)
  8.  If Not Me.NewRecord Then
  9.   'Code to run goes here
  10.  End If
  11. End Sub
Linq
Jul 31 '07 #7

missinglinq
Expert 2.5K+
P: 3,532
The code you've got will work for any change in your record, including checkboxes and radio buttons. If you want to perform something when the value of a particular control (checkbox, radio button or whatever) you have to put the code in the BeforeUpdate sub for the particular control.
Jul 31 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.