I have a series of Forms to change Label captions (language) that are stored in tables.
From an administration form with buttons I want to call a Sub to write the desired table captions to each label on the form. The problem I am having is getting the function to use the desired form's reference so I can read the controls on the form and then replace the caption. I know my code works using with a Call Write_LablTx("Chinese", Me) if I make the call from a button on Target_form with labels to change. However, I want to make the call from another form with buttons (Language_Admin). So far, I have not found a way to pass the reference to the Public Sub LablTx and reference on Target_Form. I see several posts about referencing other forms, but no code I have tried seems to work. Any help appreciated.
Sample of my code:
Language_Admin form on click event:
********************
Private Sub Command0_Click()
Call Write_LablTx("Chinese", Me) 'This works when I make the call from the Target_Form with labels to change.
End Sub
*********************
Public Sub Write_LablTx(Language As String, F As Form)
Dim db As Database
Dim rs As Recordset
Dim Ctl As Control
Dim LabelTxt As String
Dim Txt As String
Set db = CurrentDb
Set rs = db.OpenRecordset("Language_Test")
Txt = F.Name
Debug.Print Txt
'Write to Label Text Table
For Each Ctl In F.Controls
rs.Edit
Txt = Ctl.Name
LabelTxt = rs.Fields(Language)
F.Controls(Txt).Caption = LabelTxt
Debug.Print Ctl.Name & ":" & F.Controls(Txt).Caption
rs.MoveNext
Next
rs.Close
Set rs = Nothing
db.Close
End Sub