oxicottin
Learning by pecking away....
- Local time
- Today, 18:27
- Joined
- Jun 26, 2007
- Messages
- 888
I have a main form with a sub form.... The main form has 3 controls (1 text box, 2 combo boxes) and when I enter data I need to run a Public function that if the controls are null then do nothing but if they have data then run SQL and update the subform.
I used On Change, Before Update, After Update, lost focus and has focus for the three controls to update the subform and it will not do it. If I close the form and reopen it and resect anything within the 3 controls, then it will run the function and update the subform.
What in the code below can I change in order to accomplish this?
I used On Change, Before Update, After Update, lost focus and has focus for the three controls to update the subform and it will not do it. If I close the form and reopen it and resect anything within the 3 controls, then it will run the function and update the subform.
What in the code below can I change in order to accomplish this?
Code:
Private Sub cboEmployee_Change()
CreateLabelList
End Sub
Private Sub txtCountDate_Change()
CreateLabelList
End Sub
Private Sub cboShift_Change()
CreateLabelList
End Sub
Public Function CreateLabelList()
Dim strSQL As String
If IsNull(txtCountDate) Or (txtCountDate) = "" _
Or IsNull(cboShift) Or (cboShift) = "" _
Or IsNull(cboEmployee) Or (cboEmployee) = "" Then
'Do nothing
Else
strSQL = "Insert into tbl_InventoryDetails(ProductDataID,InventoryOverviewID) Select ProductDataID, " & InventoryOverviewID & " AS OID from tbl_ProductData WHERE IsInactive = False"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Me.sfrm_InventoryDetails.Form.Requery
End If
End Function