How do I Filter Without Saving the Data Used

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aswgawlag
    New Member
    • Nov 2011
    • 16

    How do I Filter Without Saving the Data Used

    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:

    Code:
    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.
    Last edited by NeoPa; Nov 24 '11, 03:18 AM. Reason: Added mandatory [CODE] tags for you
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You need to unbind the textbox you're using to search from the record source.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32634

      #3
      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.

      Comment

      Working...