Kamis, 08 September 2011

[MS_AccessPros] Re: Closing report from parameters form

 

Check the txtWhereClause control for a value before setting the recordsource, if there's nothing there, set Cancel=True in the Form Open event

--- In MS_Access_Professionals@yahoogroups.com, "glcass58" <glcass58@...> wrote:
>
> Hi there-
>
> I have a basic report and a parameters form. So that the users can filter, sort and group on the fly, I have it so that on the report's open event the parameters form is opened in dialog mode. The user then chooses their filters, clicks okay, and then the form hides and the report continues its open event using the appropriate filters and sorting.
>
> My question is if the user decides to cancel the report formation by clicking cancel on the parameters form, how do I properly cancel the report's open event?
>
> In case I'm not explaining myself well, here's the basic code:
>
> Private Sub Report_Open(Cancel As Integer)
> On Error GoTo Err_Report_Open
>
> DoCmd.OpenForm "Params_AdminStatusRptsl", , , , , acDialog
>
> Dim mysql As String
> mysql = ......
>
> Me.RecordSource = mysql & " where " & Forms![Params_AdminStatusRpts].[txtWhereClause]
>
> ...................................................................
>
> This is the okay button on the form.....
> Private Sub cmdOK_Click()
> On Error GoTo Err_cmdOK_Click
>
> 'call the procedure to build the where clause
> BuildWhereClause
>
> 'Now that the where clause is in a text box on the form, make the form invisible so that the report can continue to open
> Me.Visible = False
> ....................................................................
>
> This is the cancel button on the form....
> Private Sub cmdCancel_Click()
> On Error GoTo Err_cmdCancel_Click
>
> DoCmd.close
>
> Thanks in advance for your help!
> Elizabeth
>

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.


A bad score is 598. A bad idea is not checking yours, at freecreditscore.com.
.

__,_._,___

Tidak ada komentar:

Posting Komentar