If I have a form that has multiple categories (selections), how would I check and save only the ones that they selected? They don't have to fill in every category each time.
I set Booleans for each category and when they select the group I set the Boolean to true.
On the save button, I check if that Boolean is true (they selected it), make sure that at least one of the fields has a value
I can do this for one category but what if the person selected 3 out of the 11 possible categories. How do I check to make sure that at least one field per selection has a value and then save all of the data at one time. If there are not any values, pop them back to the section missing data and then try the save again.
Here is what I have so far
I set Booleans for each category and when they select the group I set the Boolean to true.
On the save button, I check if that Boolean is true (they selected it), make sure that at least one of the fields has a value
I can do this for one category but what if the person selected 3 out of the 11 possible categories. How do I check to make sure that at least one field per selection has a value and then save all of the data at one time. If there are not any values, pop them back to the section missing data and then try the save again.
Here is what I have so far
Code:
If DESelected Then
If IsNull(cmbDEType) And IsNull(txtDataEntrySheets) Then
nill = MsgBox("you must fill in at least one item in the Data Entry Section", vbCritical, "Missing data")
cmbDEType.SetFocus
Else
DESelected = False 'reset
End If
End If
If SMSelected Then
If IsNull(cmbScrappedMeterSize) And IsNull(cmbBronze) And IsNull(txtNoMetersScrapped) Then
nill = MsgBox("you must fill in at least one item in the Scrapped Meters Section", vbCritical, "Missing data")
cmbScrappedMeterSize.SetFocus
else
SMSelected = False
End If
'if all selections are ok, then save
If DESelected Or SMSelected Then
MsgBox "Almost there"
Else
'save it
DoCmd.GoToRecord , , acNewRec
End If