Help I am new and stupid.
I have a form with two list boxes and 8 text boxes. I am using an append query to update a table from a push button on the form. The two list boxes are named Area and Date. I want the two list boxes to pop up a message that says " Area and Date required " and return to the form if an area or a date is not input . Also I want a warning to pop up if these two have already been updated. Below is the code I already have. I have tried this:
"If Len(Forms!main!area) = 0 Then MsgBox "You must enter an area"
I have tried ="" and = null but neither has worked. I am at a loss for the duplicate message.
Any help will be appreciated.
Buckwheat
Private Sub Command14_Enter()
DoCmd.SetWarnings (warningsoff)
On Error GoTo Err_Command14_Click
Dim stDocName As String
stDocName = "appendfrommainmenu"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Forms!main!tload.Value = ""
Forms!main!tcharge.Value = ""
Forms!main!.tspa.Value = ""
Forms!main!.tda.Value = ""
Forms!main!.tunload.Value = ""
Forms!main!.ttraining.Value = ""
Forms!main!.tclerk.Value = ""
Forms!main!.twash.Value = ""
Forms!main!.tothernoprod.Value = ""
Exit_Command14_Click:
Exit Sub
Err_Command14_Click:
MsgBox Err.Description
Resume Exit_Command14_Click
End Sub
I have a form with two list boxes and 8 text boxes. I am using an append query to update a table from a push button on the form. The two list boxes are named Area and Date. I want the two list boxes to pop up a message that says " Area and Date required " and return to the form if an area or a date is not input . Also I want a warning to pop up if these two have already been updated. Below is the code I already have. I have tried this:
"If Len(Forms!main!area) = 0 Then MsgBox "You must enter an area"
I have tried ="" and = null but neither has worked. I am at a loss for the duplicate message.
Any help will be appreciated.
Buckwheat
Private Sub Command14_Enter()
DoCmd.SetWarnings (warningsoff)
On Error GoTo Err_Command14_Click
Dim stDocName As String
stDocName = "appendfrommainmenu"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Forms!main!tload.Value = ""
Forms!main!tcharge.Value = ""
Forms!main!.tspa.Value = ""
Forms!main!.tda.Value = ""
Forms!main!.tunload.Value = ""
Forms!main!.ttraining.Value = ""
Forms!main!.tclerk.Value = ""
Forms!main!.twash.Value = ""
Forms!main!.tothernoprod.Value = ""
Exit_Command14_Click:
Exit Sub
Err_Command14_Click:
MsgBox Err.Description
Resume Exit_Command14_Click
End Sub