Rabu, 25 Januari 2012

[MS_AccessPros] Re: Combo Box used for parameter query, form, and report

 

I found my error! I forgot to add in the code for the function.

Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view.
Dim oAccessObject As AccessObject

Set oAccessObject = CurrentProject.AllForms(strFormName)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If

End Function

Thanks!

Katrina

--- In MS_Access_Professionals@yahoogroups.com, ka0t1c_ang3l <no_reply@...> wrote:
>
> I created a custom dialog box (Vendor Dialog Box) that has a combo box and I have a query that will be the recordsource of this combo box. I've also created a report based on this query. What I want is when the report is opened it will open the Vendor Dialog Box and allow the user to select a vendor from the drop down menu, and based on that selection the report will be displayed. I have added my capital project invoice log into the AssistantNeeded folder.
>
> I'm receiving a compile error: sub or function not defined. The following is the code I'm using and I'm getting the error on the IsLoaded portion of the code:
>
> Option Compare Database
>
> Private Sub Report_Close()
> DoCmd.Close acForm, "Vendor Dialog Box"
> End Sub
>
> Private Sub Report_Open(Cancel As Integer)
> ' Set public variable to true to indicate that the report
> ' is in the Open event
> bInReportOpenEvent = True
>
> ' Open Vendor Dialog Box
> DoCmd.OpenForm "Vendor Dialog Box", , , , , acDialog
>
> ' Cancel Report if User Clicked the Cancel Button
> If IsLoaded("Vendor Dialog Box") = False Then Cancel = True
>
> ' Set public variable to false to indicate that the
> ' Open event is completed
> bInReportOpenEvent = False
> End Sub
>
> Any help is appreciated!!
>
> Thanks!
>
> Katrina
>

__._,_.___
.

__,_._,___

Tidak ada komentar:

Posting Komentar