Using parameters in reports and forms

M

Mani

Hi Bill! I've managed to figure out what I needed to do with the forms and
reports with parameters. I've attached a module to the form, so that the
form would close without having pop up parameters. All that is working
great! However, now that I've attached a module, for some reason my
switchboard is not working properly. When I click on the Switchboard manager
to edit items and what not, I get this message: Run-time error '6467': The
expression you entered is referred to an object that is closed or doesn't
exist.

Here's the code for my module:
Option Compare Database
Public bInReportOpenEvent As Boolean ' Is report in the Open event?

Function IsNull(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
IsNull = True
End If
End If
End Function

Is there something with the module that's why my switchboard isn't working
properly?? Please help!! Thanks in advance....
 
B

Bill

"IsNull" is a VBA primitive, so choose another
name for your function and see if that clears up
your problem.
Bill
 
M

Mani

Hi Bill! I finally figured out by looking at examples and such to make my
parameter form close without the parameter value window popping up. So all
that is working fine after attaching modules to the form. However, now my
switchboard is not woking after I have implemented this task. When I clicked
the Switchboard manager and tried to edit items there is a message that pops
up as follows:

Run-time error '2467': The expression you entered refers to an object that
is closed or doesn't exist.

And then it gives me option to debug.... This was what that was highlighted:

Set oAccessObject = CurrentProject.AllForms(strFormName)

Here are the codes for my module to the parameter form:


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

Function IsNull(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
IsNull = True
End If
End If
End Function

So it seems to me there is something wrong with the coding in the module.
Unless you think it's something else. Please help me.. Thanks in advance!!
Looking forward to hearing from ya!
 
B

Bill

"IsNull" is a built-in VBA function. You're likely
confusing VBA. Try changing your module to
something like:

Public Function MyIsNull(ByVal strFormName As String) As Boolean
.....
.....
MyIsNull = True
.....
End Function

And, of course, where ever you've referenced
the function.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top