Error - "The object doesn't contain the Automation object "ExperationDialog"

molnerr

Registered User.
Local time
Today, 03:14
Joined
Sep 11, 2007
Messages
18
Error - "The object doesn't contain the Automation object "ExperationDialog"

I created a form called ExperationDialog. I used the directions in Microsoft Access help titled "Use a Form to Enter Report Creiteria" When I run the report I am getting an error that says:

"The object doesn't contain the Automation object "ExperationDialog"

You tried to runa VB Procedure to set a property or Method for an object. However, the component doesn't make the property or method available for Automation Operations.

Check the componts docuentation for information on the properties methods it makes available for automation operations."

I created an unbound form with a date range & 1 other criterion

I am trying to create a report that will filter through a table and tell me whose applications are going to expire within a 3 months time frame (or quarterly), for different divisions.

I created an unbound form to accept the division name and a Beginning date and an ending date.

I want the report to show the division and all of the companies that are assigned to that division whose applications are going to expire. I also need to have a few other fields on the report from the table.

In design view I created an unbound form and created macros for the form in a macro group. (OK, Cancel, OpenForm, CloseForm).

I used the IsLoaded function and defined the function in the database. This is where I think there might be an error. The directions said to use the code from the Northwinds Database. It did not work so well. I found some other sample code on the internet, but I still get the automation error. The code I used is:

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

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strExperationDialog) <> conObjStateClosed Then
If Forms(strExperationDialog).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If

End Function

The code I found in the Northwind Database was:

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(strExperationDialog)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If

End Function


I created a query using the table fields I needed and under the critera for Division I put:
[Forms]![ExperationDialog]![Division]

and under the criteria for the Expiration Date I put:
Between [Forms]![ExperationDialog]![BeginninDate] And [Forms]![Ending Date]

I created a report using the report wizard and selected the fields from the query I created. When I run the report the form pops up, you enter the criteria and hit OK, and I get the error. After I get the error the report pops up. I get the error the first 3 times I run the report with the report poping up, but after that. The report does not generate and I do not recieve any more errors.

I did not understand the directions for what to do if it is an Access project. I am not sure if I am using an Access project or not? The database information in Visual Basics shows up as if it is a project, but that is in VB. I used the VB script to define the function for IsLoaded. How do I tell if it is an Access project .adp?

I don’t know what to do from here. How do I get this error message fixed?
 
I copied and pasted the directions that I used. They are from Access Help. I changed the text color to Blue were is says to use Not IsLoaded

Use a form to enter report criteria
Create an unbound form that prompts for report criteria
Create an unbound form.

In Design view, set the following form properties. Property Setting
Caption Name you want to appear in the title bar of the form
DefaultView Single Form
ViewsAllowed Form
ScrollBars Neither
RecordSelectors No
NavigationButtons No
BorderStyle Dialog

Add an unbound text box for each criteria you want to enter.

Set the properties for the text boxes as follows. Property Setting
Name Name that describes the type of criteria; for example, BeginningDate.
Format Format that reflects the data type of the criteria. For example, for a date criteria, select a format such as Medium Date.

Save the form and give it a name, such as Sales Dialog.
You'll add OK and Cancel command buttons to the form after you create macros for them.

Create the macros for the form in a macro group
In the Database window, click Macros , and then click the New button on the Database window toolbar.
For this procedure, you'll create four macros in a macro group.

Create a macro that opens the unbound form. Begin by clicking Macro Names to display the Macro Name column. Type a macro name, such as Open Dialog, in the Macro Name column, and then click the OpenForm action. Then set the action arguments as follows. Argument Setting
Form Name Name of the unbound form; for example, Sales Dialog
View Form
Data Mode Edit
Window Mode Dialog

Add a second action, CancelEvent, that cancels previewing or printing the report when the Cancel button on the form is clicked. Then click Conditions to display the Condition column, and type the following expression in the Condition column:

Not IsLoaded("Sales Dialog")

IsLoaded is a function defined in the Utility Functions module in the Northwind sample database. It's used to check whether a form is open in Form view or Datasheet view. You must define the IsLoaded function in your database before you can use it. (You can copy and paste this function into a utility module in your database.) For information on defining a function, click . For information about opening Northwind, click .


Create a macro that closes the form. Give the macro a name, such as Close Dialog. Click the Close action. Then set its action arguments as follows. Argument Setting
Object Type Form
Object Name Name of the unbound form
Save No

Create a macro for the OK button. This macro hides the form. Give the macro a name, such as OK, and click the SetValue action. Then set its action arguments as follows. Argument Setting
Item [Visible]
Expression No

Create a macro for the Cancel button. This macro closes the form. Give the macro a name, such as Cancel, and click the Close action. Then set its action arguments as follows. Argument Setting
Object Type Form
Object Name Name of the unbound form
Save No

Save and close the macro group. Give the macro group a name — for example, the same name that you gave the unbound form.
Add OK and Cancel command buttons to the form
Reopen the unbound form in Design view.


Create an OK command button, and set its properties as follows. (Make sure Control Wizards in the toolbox isn't pressed in.) Property Setting
Name OK
Caption OK
Default Yes
OnClick Name of the macro; for example, Sales Dialog.OK

Create a Cancel command button, and set its properties as follows. Property Setting
Name Cancel
Caption Cancel
OnClick Name of the macro; for example, Sales Dialog.Cancel

Save and close the form.
Enter the criteria in the underlying query or stored procedure for the report
Open the underlying query or stored procedure for the report in Design view.


Enter the criteria for the data. In the expression, use the Forms object, the name of the form, and the names of the controls in the criteria.
For example, in a Microsoft Access database (.mdb), for a form called Sales Dialog, you would use the following expression to refer to controls named Beginning Date and Ending Date in the query:
Between [Forms]![Sales Dialog]![Beginning Date] And [Forms]![Sales Dialog]![Ending Date]

In a Microsoft Access project (.adp), you must first explicitly name the parameters in the stored procedure; for example:
@Beginning_Date datetime, @Ending_Date datetime

and then use those parameters in the WHERE clause; for example:

WHERE Sales.ShippedDate Between @Beginning_Date And @Ending_Date

In an Access project, you set the reference to the controls on the form in the InputParameters property in the report, as shown in the next procedure.

Set the InputParameters property in the main report (Access project only)
Open the report in Design view.


Set the report's InputParameters property to a string that specifies the parameters that are passed to the stored procedure that the report is bound to. As in the following example, the string must be an expression that includes the parameters you specified in the stored procedure and the reference to the controls on the dialog box:
@Beginning_date datetime = [Forms]![Sales Dialog]![Beginning Date], @Ending_date datetime = [Forms]![Sales Dialog]![Ending Date]

Attach the macros to the main report
Open the report in Design view.


Set the following report properties. Property Setting
OnOpen Name of the macro that opens the unbound form; for example, Sales Dialog.Open Dialog
OnClose Name of the macro that closes the unbound form; for example, Sales Dialog.Close Dialog
 
I would scrap all the Macros, they're crap anyway and only use the IsLoaded function on the open event of the Report. Use the sample function from Northwind anyway, the other one's too restrictive
 
What do I need to do to replace the 4 macros?

I do not know what to do to use the IsLoaded function on the open event of the Report.

Can you give me more step by step directions?
 
Rich,

Your Example was GREAT :)!!!!!!!!!

I finally made it work. THANK YOU, THANK YOU, THANK YOU!!!!!!!!!!

I was making it a lot harder than it needed to be.
 

Users who are viewing this thread

Back
Top Bottom