Button Macro

MikeDBMan

Well-known Member
Joined
Nov 10, 2010
Messages
609
I put a macro on a button to RunMenuCommand and the command is Find. It pops up the find dialog box. How do I have the macro hide/unload/remove the find command after a single execution? Thanks in advance.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You don't. It isn't possible with a macro. If you want a find command like this, you will need to move to VBA.
 
Upvote 0
Would you mind giving me the code to do that. It can't be more than a couple lines, right? Thanks.
 
Upvote 0
Would you mind giving me the code to do that. It can't be more than a couple lines, right? Thanks.

Something like this:

Code:
Dim rst As DAO.Recordset
Dim strBookmark As String
 
Set rst = Me.RecordsetClone
strBookmark = Me.Bookmark
 
rst.FindFirst "[FieldNameHere] = " & Chr(34) & Me.SomeTextBox & Chr(34)
 
If rst.NoMatch Then
   MsgBox "There was no record found", vbExclamation, "No Data Found"
   Me.Bookmark = strBookmark
Else
    Me.Bookmark = rst.Bookmark
End If
 
rst.Close
Set rst = Nothing
 
Upvote 0
Bob,
That worked great. Thanks so much for the example. Now I have one more tool in my arsenal. I am new to Access but have worked with VBA in Excel for about 4 years and have done some great things in Excel. Hoping to get over the hump in Access. It is so much more enriched! Thanks again.
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top