Disable Replace in Search and Replace Command Button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ciara9
    New Member
    • Jul 2007
    • 22

    Disable Replace in Search and Replace Command Button

    I created a command button using the record navigation feature, find record. Does anyone know how to turn off the functionality of the "replace" tab that gives the user the ability to replace the data in a table? I would like to give the user the ability to search and recall a record with the search feature in order to locate a record for editing; however, I do not want them to have the ability to replace any data. Any information would be greatly appreciated. Thanks!!
  • Ciara9
    New Member
    • Jul 2007
    • 22

    #2
    Sorry but forgot to mention that I am placing this on a form and using the 2003 version. Thanks again.

    Comment

    • nico5038
      Recognized Expert Specialist
      • Nov 2006
      • 3080

      #3
      In general I present the users a datasheet subform where they can use the right-click pop-up for filtering and selecting the row the need.
      The datasheet can be made "read-only". Besides the datasheet I have the action buttons ADD, UPDATE and DELETE to allow the basic operation.

      Gues that will fit your needs. Check for the right-click popup possibilities:
      Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!

      and for a datasheet sample:
      Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!


      Nic;o)

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        I'm sorry, but this statement doesn't make sense!

        "I would like to give the user the ability to search and recall a record with the search feature in order to locate a record for editing; however, I do not want them to have the ability to replace any data."

        How do you edit a record without replacing any data?

        Linq ;0)>

        Comment

        • Ciara9
          New Member
          • Jul 2007
          • 22

          #5
          Thanks for the feedback and information.

          Sorry, it's hard communicating when you are typing sometimes. :)

          What I am trying to achieve is the ability to search for a record in a table on the same form where the data is entered. Once the record is retrieved, then I would like for the user to change the data by accessing the fields on the form. I am afraid if they use the replace feature, then they may globally change many records simultaneously when they should be only be changing the fields of one record at a time. I hope that makes more sense.

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            Is the field you're searching on unique, i.e. is there only one record that will match the criteria?

            Linq ;0)>

            Comment

            • Ciara9
              New Member
              • Jul 2007
              • 22

              #7
              What I would like for them to search for would be only one field and unique; however, the search and replace functionality appears to be pretty much open to all fields. From experimenting with it, whatever field you click on prior to pressing the search button is the area it filters for on the entire table. That's why I wanted to at least turn off the replace capability and force changes thru the fields on the form.

              Comment

              • puppydogbuddy
                Recognized Expert Top Contributor
                • May 2007
                • 1923

                #8
                Originally posted by Ciara9
                What I would like for them to search for would be only one field and unique; however, the search and replace functionality appears to be pretty much open to all fields. From experimenting with it, whatever field you click on prior to pressing the search button is the area it filters for on the entire table. That's why I wanted to at least turn off the replace capability and force changes thru the fields on the form.
                Pictures are worth a thousand words. See these links for HowTO's

                Search form using a textbox as a search field


                Search form using a listbox as the search field:

                Comment

                • Ciara9
                  New Member
                  • Jul 2007
                  • 22

                  #9
                  Thank you. I will check it out.

                  Comment

                  • missinglinq
                    Recognized Expert Specialist
                    • Nov 2006
                    • 3533

                    #10
                    I think pdb has the right idea; you need to utilize a custom search routine rather than using the native Find & Replace feature. I've seen a modification done on the feature in the past, but the problem, if I remember correctly, is that it involved using the SendKeys function, which is notoriously unstable!

                    Linq ;0)>

                    Comment

                    • Ciara9
                      New Member
                      • Jul 2007
                      • 22

                      #11
                      Thanks for the info. I was wondering if this was a viable option. :)

                      Comment

                      • ADezii
                        Recognized Expert Expert
                        • Apr 2006
                        • 8834

                        #12
                        Originally posted by Ciara9
                        Thanks for the info. I was wondering if this was a viable option. :)
                        I'm pretty sure that the native Find and Replace Dialog provided by Access cannot be modified in any manner, such as removing the Replace Tab. There were some very good alternatives listed which you should take a serious look at.

                        Comment

                        • missinglinq
                          Recognized Expert Specialist
                          • Nov 2006
                          • 3533

                          #13
                          The only way to disable the Replace feature is to make the form either read only or to set AllowEdits to False.

                          Comment

                          • pheasant
                            New Member
                            • Dec 2011
                            • 1

                            #14
                            Turn this:
                            _______ . _______
                            | Find . . .\ | Replace \
                            | . . . . . . . ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯
                            | . . . . . . . . . . . _______________
                            | .Find What: .| . . . . . . . . . . . . . . . |
                            | . . . . . . . . . . . ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                            To this:
                            _______
                            | Find . . .\
                            | . . . . . . . ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯
                            | . . . . . . . . . . . _______________
                            | .Find What: .| . . . . . . . . . . . . . . . |
                            | . . . . . . . . . . . ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                            By turning this:
                            Code:
                            Private Sub cmdSearch_Click()
                            On Error GoTo Err_cmdSearch_Click
                            
                                Screen.PreviousControl.SetFocus
                                DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
                            
                            Exit_cmdSearch_Click:
                                Exit Sub
                            
                            Err_cmdSearch_Click:
                                MsgBox Err.Description
                                Resume Exit_cmdSearch_Click
                            
                            End Sub
                            Into this:
                            Code:
                            Private Sub cmdSearch_Click()
                            On Error GoTo Err_cmdSearch_Click
                            
                                Screen.PreviousControl.SetFocus
                                [U][B]Me.AllowEdits = False[/B][/U]
                                DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
                                [U][B]Me.AllowEdits = True[/B][/U]
                            
                            Exit_cmdSearch_Click:
                                Exit Sub
                            
                            Err_cmdSearch_Click:
                                MsgBox Err.Description
                                Resume Exit_cmdSearch_Click
                            
                            End Sub
                            Last edited by NeoPa; Dec 9 '11, 03:41 PM. Reason: Added mandatory [CODE] tags for you

                            Comment

                            Working...