i have a question about access 2000 or 2003 , i need to make a macro that opens the form and automatically clicks a button that runs a query , how can i do this, may some example can help me to do this ? any suggestions ? my idea is to run something like this:
Sub Refreshfiledata()
m = MsgBox("Are you sure you want to run this macro ?.", vbYesNo)
If m = 6 Then
Application.DisplayAlerts = False
SendKeys "{Enter}"
Application.DisplayAlerts = True
MsgBox "Done"
End If
End Sub
Sendkeys is almost never a solution to anything.
You could put something like this in a module:
Which would refer to this code on form1, note that the word
Privatethat Access usually adds before Sub has been deleted:You would have to alter the code to suit your set-up.