Help! updating a form field from a module function

  • Thread starter Thread starter Twig
  • Start date Start date
T

Twig

Greetings,

I would appreciate a tip or two on the following:

1. I have a Module function, that based on a condition will change the
value of a form field.

2. I am passing the form control name to my function like this:
MyFunction (ctlname) I have ctlname set to
ctlCurrentControl.Name.

3. Everything works fine up to this point.

4. However when the condition in the Module function is met, I wanted
to update the form field by saying: ctlname = "some new value".

This doesn't work and requires me to refer to the full form and field
name. example: forms!
frmUserForm.txtJobNumber.


Any help would be appreciated.


Thanks,

Twig
 
You could declare a variable of type "control" in your function and pass the
control itself by reference. Alternately, you could pass two strings, one
for the form name (say sFormName) and one for the control name (ctlname),
then in your function:

Forms(sFormName).controls(ctlname) = "some new value"
 
Back
Top