How to add on dbl click option to all fields of the form

  • Thread starter Thread starter slundrigan via AccessMonster.com
  • Start date Start date
S

slundrigan via AccessMonster.com

I have a simple data entry form When users enter data outside of what is in
the field (combo box) I want to allow entry of new options by opening another
form. I have managed to add this capability to one of the fields. But I
have 30 fields and was looking for an easy way to add the option to all
fields without having to change each one indivaiually. I'm sure there is
something easy I'm overlooking.

Thanks,

Stan.
 
Hi

This may sound too obvious or maybe I have misunderstood but have you
tried highlighting all your fields on the form and then changing the
properties?

You can highlight multiple controls by holding down the shift key and
clicking with the mouse or by clicking somewhere on your form and
dragging the mouse over all the controls at once.

James
 
Thanks for the insight.

I tried and it didn't work. Here is a small example: I select multiple
fields and open properties. Under the event tab I go to On not in list and
select event procedure. but when I click on the button to the right nothing
happens...Where do I go from here?

Stan.
 
As you say you have your code which you have written once which should
be something as follows:

Private Sub Combo1_NotInList(NewData As String, Response As Integer)
'Code here
End Sub

You can just copy and paste this but change the name of the combo after
where it says 'Private Sub'.

Another way of speeding this up and is great for maintenance is write a
function or sub with the action you want to do, i.e.

Private Sub DoSomething()
DoCmd.OpenForm "table12", acNormal, , , acFormAdd
End sub

Then for each of your fields rather than type the docmd.... just put
DoSomething(). Then if you ever needed to change the actions, you just
have to do it once, i.e.
Private Sub Combo1_NotInList(NewData As String, Response As
Integer)
DoSomething
End Sub

James
 
Back
Top