Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting the Refresh Command Button to VBA 1

Status
Not open for further replies.

Drisconsult

Technical User
Feb 20, 2005
79
US
Hello All
I am at present, converting all the macros in my library of databases to VBA. The only problem I am having is getting rid of the Refresh Command Button and simply having VBA code to refresh a Form underneath a Label.
I have never really liked these buttons as they tend to be too big and cumbersome.
Regards
Terence
 
If you made the command button by using the command button wizard, Access produced the VBA for you. Select the command button in design view and bring up its property sheet. Click the Event Tab. You'll see "Event Procedure" next to On Click. Click in that box, then click the button with the three dots. This'll put you in VBA and you'll see the code. You can then highlight DoMenuItem and hit F1 to see the syntax and explanation.
Reread your post, you can resize the buttons.
 
Hello fneily

You will forgive my ignorance, but I can't find DoMenuItem. I'm using Access 2002. Looking at the Help Menu suggests that it might have been substituted for the Run command, or have I got it wrong?

Regards
Terence
 
I have Access 2000 that still uses the DoMenuItem. But if you go into VBA then the Help menu and type in DoMenuItem it should come up. Microsoft upgraded to the RunCommand. So it you search on that you'll find acCmdRefresh. VBA would look like
DoCmd.RunCommand acCmdRefresh
 
Hello fneily

Many thanks for your help. I can't believe how simple it all was. I have now converted all my command buttons to labels. My reason for doing this is simple. You cannot change the colour of command buttons.

My learning curve is definitely going uphill.

Sincere regards
Terence

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top