PC Review


Reply
Thread Tools Rate Thread

Dialog Form Code

 
 
Rene
Guest
Posts: n/a
 
      13th Apr 2009
A visual basic function I used in Access 03 is not working in Access 07.

Basically, I copied and pasted the following code into the On Open and On
Close Event of the report, as I'm transferring everything from Access 03 to
07:

--------------------------------------------------------------

Option Compare Database

Private Sub Report_Close()
DoCmd.Close acForm, "rptdlgfrm_Date Range"
End Sub

Private Sub Report_Open(Cancel As Integer)

bInReportOpenEvent = True

DoCmd.OpenForm "rptdlgfrm_Date Range", , , , , acDialog

If IsLoaded("rptdlgfrm_Date Range") = False Then Cancel = True

bInReportOpenEvent = False

End Function

--------------------------------------------------------------

When I run the report, the visual basic window comes up and displays the
following message:

Compile error: Sub or Function not defined.

--------------------------------------------------------------

Please help.

Rene


 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      13th Apr 2009
IsLoaded isn't a built-in function. Check your old database for the code,
and copy it into your new one.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Rene" <(E-Mail Removed)> wrote in message
news:922A5895-E7F3-4F51-AAED-(E-Mail Removed)...
>A visual basic function I used in Access 03 is not working in Access 07.
>
> Basically, I copied and pasted the following code into the On Open and On
> Close Event of the report, as I'm transferring everything from Access 03
> to
> 07:
>
> --------------------------------------------------------------
>
> Option Compare Database
>
> Private Sub Report_Close()
> DoCmd.Close acForm, "rptdlgfrm_Date Range"
> End Sub
>
> Private Sub Report_Open(Cancel As Integer)
>
> bInReportOpenEvent = True
>
> DoCmd.OpenForm "rptdlgfrm_Date Range", , , , , acDialog
>
> If IsLoaded("rptdlgfrm_Date Range") = False Then Cancel = True
>
> bInReportOpenEvent = False
>
> End Function
>
> --------------------------------------------------------------
>
> When I run the report, the visual basic window comes up and displays the
> following message:
>
> Compile error: Sub or Function not defined.
>
> --------------------------------------------------------------
>
> Please help.
>
> Rene
>
>



 
Reply With Quote
 
Dale Fye
Guest
Posts: n/a
 
      13th Apr 2009
My first guess would be that you don't have a function IsLoaded in your new
database.

Try this:

If currentproject.Allforms("prgdlgfrm_Date Range").isloaded = False then
Cancel = true

----
HTH
Dale



"Rene" wrote:

> A visual basic function I used in Access 03 is not working in Access 07.
>
> Basically, I copied and pasted the following code into the On Open and On
> Close Event of the report, as I'm transferring everything from Access 03 to
> 07:
>
> --------------------------------------------------------------
>
> Option Compare Database
>
> Private Sub Report_Close()
> DoCmd.Close acForm, "rptdlgfrm_Date Range"
> End Sub
>
> Private Sub Report_Open(Cancel As Integer)
>
> bInReportOpenEvent = True
>
> DoCmd.OpenForm "rptdlgfrm_Date Range", , , , , acDialog
>
> If IsLoaded("rptdlgfrm_Date Range") = False Then Cancel = True
>
> bInReportOpenEvent = False
>
> End Function
>
> --------------------------------------------------------------
>
> When I run the report, the visual basic window comes up and displays the
> following message:
>
> Compile error: Sub or Function not defined.
>
> --------------------------------------------------------------
>
> Please help.
>
> Rene
>
>

 
Reply With Quote
 
Rene
Guest
Posts: n/a
 
      15th Apr 2009
Good afternoon Dale,

It worked!

Thanks a million!!!

Rene

"Dale Fye" wrote:

> My first guess would be that you don't have a function IsLoaded in your new
> database.
>
> Try this:
>
> If currentproject.Allforms("prgdlgfrm_Date Range").isloaded = False then
> Cancel = true
>
> ----
> HTH
> Dale
>
>
>
> "Rene" wrote:
>
> > A visual basic function I used in Access 03 is not working in Access 07.
> >
> > Basically, I copied and pasted the following code into the On Open and On
> > Close Event of the report, as I'm transferring everything from Access 03 to
> > 07:
> >
> > --------------------------------------------------------------
> >
> > Option Compare Database
> >
> > Private Sub Report_Close()
> > DoCmd.Close acForm, "rptdlgfrm_Date Range"
> > End Sub
> >
> > Private Sub Report_Open(Cancel As Integer)
> >
> > bInReportOpenEvent = True
> >
> > DoCmd.OpenForm "rptdlgfrm_Date Range", , , , , acDialog
> >
> > If IsLoaded("rptdlgfrm_Date Range") = False Then Cancel = True
> >
> > bInReportOpenEvent = False
> >
> > End Function
> >
> > --------------------------------------------------------------
> >
> > When I run the report, the visual basic window comes up and displays the
> > following message:
> >
> > Compile error: Sub or Function not defined.
> >
> > --------------------------------------------------------------
> >
> > Please help.
> >
> > Rene
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for "OK" in Dialog Box to lead to selected records in Form Vi Natasha Microsoft Access Form Coding 1 12th May 2010 09:07 PM
Opening a form as datasheet and dialog will not pause code roel.schreurs@gmail.com Microsoft Access Form Coding 1 13th Oct 2006 05:10 PM
Need code for dialog for dialog box to sort. =?Utf-8?B?Um9uIFdlYXZlcg==?= Microsoft Access Getting Started 5 19th Mar 2006 10:06 PM
start dialog at startu and have the form drawn prior to the dialog =?Utf-8?B?SGFucw==?= Microsoft Dot NET Framework Forms 3 20th Dec 2005 08:12 PM
how can i use built-in dialog icons in a custom dialog form? K. Shier Microsoft Dot NET Framework Forms 0 12th Aug 2003 08:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:00 AM.