Full Version: VBA Error
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
JessHolbrook
Hello,

I have absolutely no training in VBA, but I have a project on my lap through work that I'm trying to muddle through. I've been using tutorials & internet research to teach myself to use Access, & right now I'm trying to create a report that uses a form to run a parameter.

I'm using code given in a Microsoft Access help article, but when I entered it, I tried to open the report & was brought back into VBA for a code error. I'm not sure if I am misinterpreting the article I'm using, or if there is perhaps a typo in the article, or what--with no knowledge of this code, I could have it one character off & would have no way to know the difference.

I'm hoping someone here can take a look & see if anything jumps out at them? Thanks for your time & help, I appreciate it!

< Jess

Code:

Private Sub Report_Open(Cancel As Integer)
'Set public variable to true to indicate that the report
'is in the Open event
blnReportOpenEvent = True

'Open Select Alpine Program Lookup
DoCmd.OpenForm "Select Alpine Program Lookup", , , , , acDialog

'Cancel Report if User Clicked the Cancel Button
If IsLoaded("Select Alpine Program Lookup") = False Then Cancel = True

'Set public variable to false to indicate that the
'Open event is completed
blnReportOpenEvent = False
End Sub
theDBguy
Hi Jess,

Could you tell us what is the error message you're getting and which line is highlighted when you debug the code? Thanks.
JessHolbrook
No problem!

The pop up dialog says, "Compile error: Sub or function not defined"

The text IsLoaded is highlighted in gray when this comes up, as if I highlighted it to replace the text. Then, when I click OK in the pop up, the line

Private Sub Report_Open(Cancel As Integer)

is highlighted in yellow with a yellow arrow pointed at it.

Thanks for your help & prompt response!

< Jess
theDBguy
Thanks. From the MS article where you copied that code, did they explain about the IsLoaded() function?

IsLoaded() is not a built-in function in Access. You will have to find the code for that function and also add it to your database.

Hope that helps...
JessHolbrook
Whoops, looks like I solved the problem. I hadn't included a line in my Module, so when I corrected that, everything began to work properly. My mistake, so sorry!

Thanks anyways for your willingness to help, it's much appreciated! I'm sure I'll be back again soon, I usually am.... <

< Jess
theDBguy
Hi Jess,

Glad to hear you got it sorted out. Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.