VBA passing form and field name into function

G

Gil

I'm new to VBA, in order to make my code less redundant I would like to
pass in a form field and recordset into a function. I got the passing
of the recordset to work, but I can't seem to get the formfield to pass
in. What would I declare it as? I tried declaring it as a string but
that won't work. Basically I want to read in a recordset and set a
value a form from that recordset. I have about 10 different recordsets
and which I need to do exactly the same processing, so I don't want to
write the code 10 times.

I declared the function as

Function (RecordSetIn As RecordSet, FormFieldIn As String)

An example of the formfield I need to write out to is:

Forms![Health_Tbl]![Technical_Overview]


Any help would be great.

Thanks,
Gil
 
G

Gil

Got it:

Function AlterField (RecordSetIn As RecordSet, FormFieldIn As Control)

Calling:
AlterField RecordSetIn, Forms![Health_Tbl]![Technical_Overview]
 
Top