Hello folks,I am playing with a new function that will loop through every control. In addition to looping through the forms controls I want to obtain the value of that the control has. That is where I am having problems. I can loop through the controls but I can not get the values from the forms:
As you can see i have to examples of setformvalue. The first example in Line 1 works but I have to specify the form and control manually. What I am trying to do with Line 2 is use the automated method in the form loop to get the control (which works) and then figure out the syntax on how to duplicate Line 1 problematically in Line 2.
Code:
Public Function AuditCheck(frm As Form) Dim setformvalue As String Dim ctl As Control For Each ctl In frm If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or ctl.ControlType = acListBox Then mytemp = ctl.Name LINE 1 -------> 'setformvalue = Forms![frm_Admin_employee]![txt_empid] LINE 2 -------> setformvalue = frm.Controls.ctl.Name End If Next ctl Set ctl = Nothing End Function
Comment