I have a search form that consists of text boxes and combo boxes. If I type 10001, for example, into the Document Number text box and click my search button, it searches and pulls up the records just fine; however, when I exit out of the form and check my table, 10001, has been added as a new record. I do not want this to happen. I had written a vba code to set the form to read-only thinking that would help, but it hasn't. Here's the code I used to make the form read-only and for it to open to a blank form:
- Private Sub Form_Load()
-
DoCmd.GoToRecord , , acNewRec
-
DoCmd.OpenForm "FormSearchCMRecord", , , , acFormReadOnly
-
End Sub
I have a couple other forms as well, such as an add record form, an update record form, and a delete record. I made separate forms, so we could better control our documents as all are restricted with passwords, except the search record form.