By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,611 Members | 1,699 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,611 IT Pros & Developers. It's quick & easy.

How do I Filter Without Saving the Data Used

P: 16
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. DoCmd.GoToRecord , , acNewRec
  3. DoCmd.OpenForm "FormSearchCMRecord", , , , acFormReadOnly
  4. 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.
Nov 23 '11 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 10K+
P: 12,421
You need to unbind the textbox you're using to search from the record source.
Nov 23 '11 #2

Expert Mod 15k+
P: 31,712
Indeed. Controls for filtering data should generally be unbound controls. See Example Filtering on a Form for more on this.

PS Please read [code] Tags Must be Used before posting again.
Nov 24 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.