473,388 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

IsLoaded compile error

imrosie
222 100+
Hello,

Is there anyone who can help me figure out how to resolve this conflict when I try to re-compile?
It keeps telling the sub or routine is not defined...but it is!?! I think (I'm a newbie)
Here's the procedure:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Dim strRecordSource As String
  3.  
  4.     If IsLoaded("PrintInvoiceDialog") Then
  5.         strRecordSource = "SELECT * FROM Invoices WHERE OrderID = " & Forms!PrintInvoiceDialog.OrderID
  6.         Me.RecordSource = strRecordSource
  7.     End If
  8.  
thanks in advance
Rosie
Aug 1 '07 #1
7 3068
MitchR
65 64KB
IsLoaded is used to determine if an AccessObject is currently loaded. Typically IsLoaded is Preceeded by an expression.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Report_Open(Cancel As Integer)
  3. Dim strRecordSource As String
  4.  
  5. If <expression>.IsLoaded("PrintInvoiceDialog") Then
  6.         strRecordSource = "SELECT * FROM Invoices WHERE OrderID = " & Forms!PrintInvoiceDialog.OrderID
  7.         Me.RecordSource = strRecordSource
  8.         Else
  9.     End If
  10. End Sub
  11.  
Here is a link to give some additional details:
http://msdn2.microsoft.com/en-us/library/bb213660.aspx
Aug 1 '07 #2
imrosie
222 100+
IsLoaded is used to determine if an AccessObject is currently loaded. Typically IsLoaded is Preceeded by an expression.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Report_Open(Cancel As Integer)
  3. Dim strRecordSource As String
  4.  
  5. If <expression>.IsLoaded("PrintInvoiceDialog") Then
  6.         strRecordSource = "SELECT * FROM Invoices WHERE OrderID = " & Forms!PrintInvoiceDialog.OrderID
  7.         Me.RecordSource = strRecordSource
  8.         Else
  9.     End If
  10. End Sub
  11.  
Here is a link to give some additional details:
http://msdn2.microsoft.com/en-us/library/bb213660.aspx

Thanks MitchR for your feedback. I thought that '("PrintInvoiceDialog")', the form was being passed to the IsLoad, to complete the expression. It works like this on another form (of my colleges). I just imported the forms required to make it work.

PrintInvoiceDialog is required to be open for this to work.....the error message says the 'sub or function is not defined'. I went to that weblink, it was somewhat confusing as I'm still a newbie. thanks anyway.

Rosie
Rosie
Aug 1 '07 #3
missinglinq
3,532 Expert 2GB
I don't know where you got the code from, Rosie, but I doubt that it has ever run in Access VBA! As the error message indicated, IsLoaded is not a sub or function, which is how you've attempted to use it

IsLoaded("PrintInvoiceDialog")

but rather is a Property of an object, like .Enabled or .SetFocus and thus

the "sub or function is not defined" error message. The <expression> has to be an expression representing an object. I think you need to replace

If <expression>.IsLoaded("PrintInvoiceDialog") Then

with

If CurrentProject.AllForms("PrintInvoiceDialog").IsLo aded = True Then

Good Luck!

Linq ;0)>
Aug 1 '07 #4
imrosie
222 100+
I don't know where you got the code from, Rosie, but I doubt that it has ever run in Access VBA! As the error message indicated, IsLoaded is not a sub or function, which is how you've attempted to use it

IsLoaded("PrintInvoiceDialog")

but rather is a Property of an object, like .Enabled or .SetFocus and thus

the "sub or function is not defined" error message. The <expression> has to be an expression representing an object. I think you need to replace

If <expression>.IsLoaded("PrintInvoiceDialog") Then

with

If CurrentProject.AllForms("PrintInvoiceDialog").IsLo aded = True Then

Good Luck!

Linq ;0)>
Thanks Missinglinq,,,I'm going off to try this out...will report back for the benefit of others.
Rosie
Aug 2 '07 #5
ADezii
8,834 Expert 8TB
Hello,

Is there anyone who can help me figure out how to resolve this conflict when I try to re-compile?
It keeps telling the sub or routine is not defined...but it is!?! I think (I'm a newbie)
Here's the procedure:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Open(Cancel As Integer)
  2. Dim strRecordSource As String
  3.  
  4.     If IsLoaded("PrintInvoiceDialog") Then
  5.         strRecordSource = "SELECT * FROM Invoices WHERE OrderID = " & Forms!PrintInvoiceDialog.OrderID
  6.         Me.RecordSource = strRecordSource
  7.     End If
  8.  
thanks in advance
Rosie
Hello Rosie, long time no see. If you wish to maintain your current syntax:
  1. Copy and Paste this Function to a Standard Code Module.
    Expand|Select|Wrap|Line Numbers
    1. Public Function IsLoaded(ByVal strFormName As String) As Boolean
    2. 'Returns True if the specified form is open in Form view or Datasheet view.
    3.  
    4.  Const conObjStateClosed = 0
    5.  Const conDesignView = 0
    6.  
    7.  If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    8.    If Forms(strFormName).CurrentView <> conDesignView Then
    9.      IsLoaded = True
    10.    End If
    11.  End If
    12. End Function
  2. You would then use it in this manner.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Report_Open(Cancel As Integer)
    2. Dim strRecordSource As String
    3.  
    4. If IsLoaded("PrintInvoiceDialog") Then
    5.   strRecordSource = "SELECT * FROM Invoices WHERE OrderID = " & Forms!PrintInvoiceDialog.OrderID
    6.   Me.RecordSource = strRecordSource
    7. End If
    8. End Sub
Aug 2 '07 #6
imrosie
222 100+
Hello Rosie, long time no see. If you wish to maintain your current syntax:
  1. Copy and Paste this Function to a Standard Code Module.
    Expand|Select|Wrap|Line Numbers
    1. Public Function IsLoaded(ByVal strFormName As String) As Boolean
    2. 'Returns True if the specified form is open in Form view or Datasheet view.
    3.  
    4.  Const conObjStateClosed = 0
    5.  Const conDesignView = 0
    6.  
    7.  If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    8.    If Forms(strFormName).CurrentView <> conDesignView Then
    9.      IsLoaded = True
    10.    End If
    11.  End If
    12. End Function
  2. You would then use it in this manner.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Report_Open(Cancel As Integer)
    2. Dim strRecordSource As String
    3.  
    4. If IsLoaded("PrintInvoiceDialog") Then
    5.   strRecordSource = "SELECT * FROM Invoices WHERE OrderID = " & Forms!PrintInvoiceDialog.OrderID
    6.   Me.RecordSource = strRecordSource
    7. End If
    8. End Sub
Hi ADezii,

It's been a while since I've 'read' from you...but I post at least
2 or 3 times/week...

Thanks for this...I'm going to put that in now. I'll report back, but have no doubt that if it's from you, it will work. take care

Rosie

forgot to mention that I did try missinglinq's code,,,it worked too. I like the idea though of a 'Public' function though. take care.
Aug 2 '07 #7
ADezii
8,834 Expert 8TB
Hi ADezii,

It's been a while since I've 'read' from you...but I post at least
2 or 3 times/week...

Thanks for this...I'm going to put that in now. I'll report back, but have no doubt that if it's from you, it will work. take care

Rosie

forgot to mention that I did try missinglinq's code,,,it worked too. I like the idea though of a 'Public' function though. take care.
You too, Rosie - good to hear from you again!
Aug 2 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new...
3
by: Mark Richards | last post by:
I have this code behind a report (same report as previous post); Sub Report_Open(Cancel As Integer) DoCmd.OpenForm "Report Date Range", , , , , acDialog, "Activity By Location" If Not...
1
by: bbdata | last post by:
strange thing happened when i split my database. i have a search form where you enter parameters, and get back filtered records displayed on another form. when you close this one, theres a code in...
10
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
9
by: ThunderMusic | last post by:
Hi, I'd like to create a compile time error in my class... maybe there's a way already built in in the framework so I can achieve what I want... I have 2 constructors in my class. One of them...
4
by: tony | last post by:
Hello! My question is about calling this method CollectData below but I get a compile error that I shouldn't have because the type parameter is correct. The compile error is the following:...
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
15
by: JohnHo | last post by:
here is the deal I have a form with a command button to open another form. I would like to check if another form is loaded and use the code to close that form. simple right? Dim obj As...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.