Date Range in 2007

D

Davo78

Hi All

I am currently upgrading a DB from Access 2000 to 2007.
I have been using a Form "Report Date Range" which has the following :

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "Payments Due"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "Report Date Range"
End Sub
Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub

This works fine in 2000 but I get error message in 2007:
MS VB -- Compile Error: Sub or Function not defined, with "IsLoaded"
highlighted, I have not been able find a solution, can anyone help.

Thanks in advance
Davo
 
A

Allen Browne

IsLoaded() is not a built-in function. It does appear in the Northwind
sample database, so may people copy it from there.

The error may mean any of these:

a) You don't have the IsLoaded() function in your database.

b) The IsLoaded() function is in the wrong place (e.g. in the module of a
form, when you need it in a standard module.)

c) The database is partically corrupt, and needs a decompile. Post back if
you need details of this.
 
D

Davo78

Allen
Thank you for your prompt reply
How can I check if IsLoaded() function is in my database.

I copied the Report Date Range from Northwind

Davo
 
D

Davo78

Allen
The search only finds 1 reference and that is in the "Reort Date Range" code.
How can I add this,

Thanks again

Davo
 
A

Allen Browne

You can copy it from Northwind.mdb (find it on your hard drive), the
Utilities module. Paste it into a new module.

Alternatively, you could just change the line:
If Not IsLoaded("Report Date Range") Then
to:
If CurentProject.AllForms("Report Date Range").IsLoaded Then
 
D

Davo78

Allen

IsLoaded is installed in "Access-AccessObject" of my current project the
same as in Northwind, this still does not work.
I tried your suggested code change, this displays the Form "Report Date
Range" and allows date inputs, but stops on the line If
CurentProject.AllForms("Report Date Range").IsLoaded Then
Any suggestions

Davo
 
A

Allen Browne

I don't have any other suggestions.

CurrentProject is part of the Access library.

IsLoaded() is from Northwind.

Take your pick.
 
D

Davo78

Allen

Thanks for your help and interest.

Davo


Allen Browne said:
I don't have any other suggestions.

CurrentProject is part of the Access library.

IsLoaded() is from Northwind.

Take your pick.
 
D

Davo78

Allen

Using If CurentProject.AllForms("Report Date Range").IsLoaded Then
I now get
Error message "Object required"

Thanks again
Davo
 
A

Allen Browne

Davo, I may have to leave the debugging side with you.

It could even be something simple like double-r.
 

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