I don't think we're on the same page
When the form opens, data entry is defaulted to "no". The only way the user is able to add new records is by clicking the command button that changes data entry to "yes".
Allow additions is also defaulted to "no", which is why when you open the form the subforms are not visible. I want the user to be able to edit records but not add any additions when they open the form. If they click the command button, they'll be able to add new records (This is working properly, if you click the button, the subforms are visible again). Clicking the command button again changes data entry back to "no", and the subforms become invisible again.
The desired result is: when you open the form you can view the records and make edits to them, clicking the command button allows the user to create new records, and clicking it again changes it back to editing only.
The issue I'm trying to overcome here is that if allow additions is set to "yes" and data entry is set to "no", it is possible to accidentally add a new record without meaning to. I was trying to overcome this by setting allow additions to "no", but this makes the subforms invisible, which is supposedly because they're not opening to the first record.
EDIT:
Okay so what you were telling me clicked and I realized my mistake, I apologize again for that.
I did what you said, and it caused issues with the form. It would work at first (at least I think it would, hadn't gotten around to testing it it stopped new entries), but after using the command button to go from data entry "yes" to "no" a few times, it starts to give errors in my code. Heres what I did:
Code:
If Me.DataEntry = False Then
If Me.NewRecord = True Then
Me.Undo
End If
End If
I used the first if statement because if data entry is set to "yes" then I don't want to prevent new records. I think the second if statement is whats causing the issues, because every time I change data entry from "yes" to "no" it tries to undo the new record, which then causes the code in the button that changes the data entry value to give an error, but thats just my theory as to why this is happening.
If you know a better way to code this please let me know, I'm not sure how to set this up so when it tries to add the record it will stop it.
I hope that clears things up, unless I'm the one not understanding what you're trying to tell me, in which case I apologize.
In either case, I appreciate the response.