Find and replace without replace

I have placed a button on my form assigning the find function. The code is:

DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Is there any way to remove the Replace tab on this function.

Thanks in advance.
reido2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

blakeh1Commented:
if you are just trying to move to a record that matches an input value use the following rather than find replace
 the below uses an input box to get the value they are searching for and it looks in the ID field. If you want them to be able to search any field this will have to be modified

Private Sub Command4_Click()
    Dim retval As Variant
    Dim rs As Recordset
    On Error GoTo Err_Command4_Click
    retval = InputBox("Enter the value")
    If retval <> "" And Not IsNull(retval) Then
        Set rs = Me.RecordsetClone
        rs.MoveFirst
        rs.FindFirst ("ID = " & retval)
        If rs.NoMatch Then
            msgbox "No Match Found!"
        Else
            Me.Bookmark = rs.Bookmark
        End If
    End If

Exit_Command4_Click:
    On Error Resume Next
    rs.Close
    Set rs = Nothing
    Exit Sub
Err_Command4_Click:
    MsgBox Err.Number & " " & Err.Description
    Resume Exit_Command4_Click
End Sub
0
blakeh1Commented:
here is another way that will search all fields.

Private Sub Command3_Click()
    Dim retval As Variant
   
    Me.[ID].SetFocus
    retval = InputBox("Enter the value")
    DoCmd.FindRecord retval, acEntire, , acSearchAll, , acAll
   
End Sub

If you want to search only the current field use
Private Sub Command3_Click()
    Dim retval As Variant
   
    Me.[ID].SetFocus
    retval = InputBox("Enter the value")
    DoCmd.FindRecord retval, acEntire, , acSearchAll, , acCurrent
   
End Sub
0
brewdogCommented:
Or you could just do:

    DoCmd.RunCommand acCmdFind

This pops up the Find dialog box with no Replace tab.

brewdog
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

reido2Author Commented:
Blakeh1 your second piece of code comes up with the following error in VB:

compile error:
Method or data memeber not found.

the line Me.[ID].SetFocus is displayed with the word SetFocus highlighted in blue.

Brewdog the code you posted still displays the replace tab.

Any ideas guys?
0
brewdogCommented:
Are you using Access 97 or 2000? I tested the RunCommand on my machine (97) and it worked perfectly.
0
reido2Author Commented:
Your right brewdog your code does work perfectly with 97 but there is always a replace tab with 2000. Even the findbutton wizard with 97 and 2000 are different. Same code is used but an additional replace tab in 2000. Very annoying. (My boss just doesn't want the replace tab im afraid!)  

Any ideas?
0
reido2Author Commented:
Adjusted points to 100
0
brewdogCommented:
don't suppose you want to create your own find form, eh? :o) That's brutal that Microsoft puts "improvements" together like that and ends up losing good flexibility.
0
tomk120999Commented:
reido2, brewdog's suggestion of your own Find form is relatively easy, and seems to be the best workaround.  Just make your own form to resemble the Access Form without the replace, then use a small variation of blakeh1's code (you probably won't need the SetFocus statement) to find the record.  You will also need to show a "Not Found" msgbox.  Do you also want to make the found record current on a form, or just move to it in a table/datasheet view?

good luck as usual...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
reido2Author Commented:
Ok I will do just that.

Cheers.
0
tomk120999Commented:
reido2, thanks for the points, but brewdog and blakeh1 are the real winners.  :)  Brewdog, blakeh1, I will post questions for each of you to share points on this.  I've got a full day so it might be tomorrow.

good luck as usual...
0
brewdogCommented:
I thought it was a little curious, but I wasn't going to say anything . . . :o) Reido, if you need more help on creating that Find form, let any one of us know. You've already spent points, so we can help you some more without charging you. :o)
0
reido2Author Commented:
Sorry about the mix up with the points. I will try and create the form first to see what problems I run into and I will post my questions accordingly.

Thanks for the offer.

Cheers.
reido
0
brewdogCommented:
No problem on the points. I'm glad you've got a start on a solution that will work.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.