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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perform Filter and Message box?

Status
Not open for further replies.

Ryath

Technical User
Feb 24, 2002
84
GB
Hi all,

Currently in my form i have a command button to perform a "Filter By Form" action writen below.

Private Sub PerformS_Click()
DoCmd.RunCommand acCmdFilterByForm
End Sub

There is a few other things that i would like it to do.... but i dont know if its possible... I would like it when the command is excecuted that a message box will appear asking "Would You Like to Perform a New Search?" and if Yes it will automatcially clear all grids and proceed to filter by form, and if no will proceed with the last filter?? is this possible??

Thx all

Will

 
You can get message boxes to make decisions for you because Message Boxes can have multiple buttons and return with which button was pressed.

So:-


Private Sub PerformS_Click()
If Msgbox ("Would You Like to Perform a New Search?", vbYesNo,"Decision time.") = vbYes Then
' Put the Yes I want to code here
DoCmd.RunCommand acCmdFilterByForm
' etc.. ..
Else
' Your option to do something else here.
End If
End Sub

Note the appearance of the brackets around the msgbox parameters. It is the presence of these brackets that gets Msgbox to return the value of the button pressed.



G LS
 
Thx Smudge,

But i dont know the line for clearing grids ?:/ any ideas??

Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top