I am creating a simple Access database that allows users to record the time they spend servicing an application, or set of applications.
The form (ProTrak_1) is esssentially a set of check boxes for users to select the apps they work on. What I am trying to do is get the database to look (in AfterUpdate on the form) at each check box and if the value is True then put the NAME of the text box into a text field in a subform (AppsServiced), and therefore record the Name in another table. The subform field names are A1, A2, A3, ...
So, if I've checked the box called Illustrator, the value of A1 in the subform will become "Illustrator", A2 might become "Photoshop", etc.
The Form is set to call AppSelect([Form]) in the AfterUpdate event.
Here's the code at this point. I am not getting any errors but the data is not recording. I am not primarily a programmer, so any help would be appreciated.
Function AppSelect(AppsServiced As Form)
'On Error GoTo Err_Handler
Dim C As Control, A As Integer, xName As String, AppField As Control
A = 0
AppsServiced!AppField = Chr(3)
AppsServiced!AppField = "A" & A
For Each C In MyForm.Controls
Select Case C.ControlType
Case acCheckBox
If C.Value = True Then
A = A + 1
AppsServiced!AppField(Chr(3)) = C.Name
'Form_ProTrak_1.AppsServiced.Controls.Item(AppField.Value) = C.Name
End If
End Select
Next C
TryNextC:
Exit Function
The form (ProTrak_1) is esssentially a set of check boxes for users to select the apps they work on. What I am trying to do is get the database to look (in AfterUpdate on the form) at each check box and if the value is True then put the NAME of the text box into a text field in a subform (AppsServiced), and therefore record the Name in another table. The subform field names are A1, A2, A3, ...
So, if I've checked the box called Illustrator, the value of A1 in the subform will become "Illustrator", A2 might become "Photoshop", etc.
The Form is set to call AppSelect([Form]) in the AfterUpdate event.
Here's the code at this point. I am not getting any errors but the data is not recording. I am not primarily a programmer, so any help would be appreciated.
Function AppSelect(AppsServiced As Form)
'On Error GoTo Err_Handler
Dim C As Control, A As Integer, xName As String, AppField As Control
A = 0
AppsServiced!AppField = Chr(3)
AppsServiced!AppField = "A" & A
For Each C In MyForm.Controls
Select Case C.ControlType
Case acCheckBox
If C.Value = True Then
A = A + 1
AppsServiced!AppField(Chr(3)) = C.Name
'Form_ProTrak_1.AppsServiced.Controls.Item(AppField.Value) = C.Name
End If
End Select
Next C
TryNextC:
Exit Function