A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

OnTimer event-Form does not load



 
 
Thread Tools Display Modes
  #1  
Old August 16th, 2004, 01:41 AM
LouMalnati
external usenet poster
 
Posts: n/a
Default OnTimer event-Form does not load

I call the OnTImer event when I load a form. Within the
OnTimer Function I call another function called Import().
When the Import Function and OnTimer Function is completed
and the code goes back to the original OnLoad event and the
the OnLoad even ends the form never loads.

I have stepped thru this sub several times and confirmed
that it gets to "End Sub" within the OnLoad event, but it
never loads the form.

Any ideas ?
  #2  
Old August 16th, 2004, 01:03 PM
Michel Walsh
external usenet poster
 
Posts: n/a
Default

Hi,


The Timer would fire only when it is created, so, only AFTER the form
hosting it is loaded.

==========================
Option Compare Database
Option Explicit

Private Sub Form_Load()
Debug.Print "Form_Load"
End Sub

Private Sub Form_Timer()
Debug.Print "Form_Timer"
Call Form_Load
End Sub
==========================

with a timer interval of 1000 prints, in the immediate debug window, the
messages, as expected. Your setting does not seem "clear" to me, if it is
different, what is it, with code (just the relevant parts)?



Hoping it may help,
Vanderghast, Access MVP



"LouMalnati" wrote in message
...
I call the OnTImer event when I load a form. Within the
OnTimer Function I call another function called Import().
When the Import Function and OnTimer Function is completed
and the code goes back to the original OnLoad event and the
the OnLoad even ends the form never loads.

I have stepped thru this sub several times and confirmed
that it gets to "End Sub" within the OnLoad event, but it
never loads the form.

Any ideas ?



  #3  
Old August 16th, 2004, 01:39 PM
Lou Malnati
external usenet poster
 
Posts: n/a
Default

Please note the form WILL load if LoadData never gets run
(eg. its a week-end). If LoadData gets called then for
some reason the form never loads even though I see the
OnLoad event ending (when I step-thru the code it gets to
End Sub but the form never loads.)
Option Compare Database
Option Explicit

Private Sub Form_Load()
Call Form_Timer
End Sub

Private Sub Form_Timer()
'On Error GoTo frmstartup_err

Dim dteFileTme As Date
Dim dt As Long
Dim ErrorNumber
Dim strErrorMsg As String
Dim strErrBuild As String


strErrorMsg = "FormTimer Function Failed"

dteFileTme = Format((Now), "h:mm:s am/pm")
dt = WeekDay(Date)

Select Case dteFileTme
Case #7:00:00 AM# To #4:30:00 PM#
Select Case dt
Case 2 To 6
Case Else
Exit Sub
End Select
Case Else
Exit Sub
End Select
LoadData

Exit_He
On Error Resume Next


Exit Sub

frmstartup_err: ' Error-handling routine.

ErrorNumber = Err.Number
strErrBuild = chrErrorBody & " " & ErrorNumber &
strErrorMsg & ""
SendNotesMail chrErrorSubject, "", chrRecips,
chrCcRecips, chrbccRecips, strErrBuild, True
Resume Exit_Here




End Sub




-----Original Message-----
Hi,


The Timer would fire only when it is created, so, only

AFTER the form
hosting it is loaded.

==========================
Option Compare Database
Option Explicit

Private Sub Form_Load()
Debug.Print "Form_Load"
End Sub

Private Sub Form_Timer()
Debug.Print "Form_Timer"
Call Form_Load
End Sub
==========================

with a timer interval of 1000 prints, in the immediate

debug window, the
messages, as expected. Your setting does not seem "clear"

to me, if it is
different, what is it, with code (just the relevant

parts)?



Hoping it may help,
Vanderghast, Access MVP



"LouMalnati" wrote

in message
...
I call the OnTImer event when I load a form. Within the
OnTimer Function I call another function called Import

().
When the Import Function and OnTimer Function is

completed
and the code goes back to the original OnLoad event and

the
the OnLoad even ends the form never loads.

I have stepped thru this sub several times and confirmed
that it gets to "End Sub" within the OnLoad event, but

it
never loads the form.

Any ideas ?



.

  #4  
Old August 17th, 2004, 02:26 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default

Lou,

When you say "it never loads", do you mean:
* the form displays but no controls are visible, or
* the form never displays.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyT...764559036.html


"Lou Malnati" wrote in message
...
Please note the form WILL load if LoadData never gets run
(eg. its a week-end). If LoadData gets called then for
some reason the form never loads even though I see the
OnLoad event ending (when I step-thru the code it gets to
End Sub but the form never loads.)
Option Compare Database
Option Explicit

Private Sub Form_Load()
Call Form_Timer
End Sub

Private Sub Form_Timer()
'On Error GoTo frmstartup_err

Dim dteFileTme As Date
Dim dt As Long
Dim ErrorNumber
Dim strErrorMsg As String
Dim strErrBuild As String


strErrorMsg = "FormTimer Function Failed"

dteFileTme = Format((Now), "h:mm:s am/pm")
dt = WeekDay(Date)

Select Case dteFileTme
Case #7:00:00 AM# To #4:30:00 PM#
Select Case dt
Case 2 To 6
Case Else
Exit Sub
End Select
Case Else
Exit Sub
End Select
LoadData

Exit_He
On Error Resume Next


Exit Sub

frmstartup_err: ' Error-handling routine.

ErrorNumber = Err.Number
strErrBuild = chrErrorBody & " " & ErrorNumber &
strErrorMsg & ""
SendNotesMail chrErrorSubject, "", chrRecips,
chrCcRecips, chrbccRecips, strErrBuild, True
Resume Exit_Here




End Sub




-----Original Message-----
Hi,


The Timer would fire only when it is created, so, only

AFTER the form
hosting it is loaded.

==========================
Option Compare Database
Option Explicit

Private Sub Form_Load()
Debug.Print "Form_Load"
End Sub

Private Sub Form_Timer()
Debug.Print "Form_Timer"
Call Form_Load
End Sub
==========================

with a timer interval of 1000 prints, in the immediate

debug window, the
messages, as expected. Your setting does not seem "clear"

to me, if it is
different, what is it, with code (just the relevant

parts)?



Hoping it may help,
Vanderghast, Access MVP



"LouMalnati" wrote

in message
...
I call the OnTImer event when I load a form. Within the
OnTimer Function I call another function called Import

().
When the Import Function and OnTimer Function is

completed
and the code goes back to the original OnLoad event and

the
the OnLoad even ends the form never loads.

I have stepped thru this sub several times and confirmed
that it gets to "End Sub" within the OnLoad event, but

it
never loads the form.

Any ideas ?



.



  #5  
Old August 17th, 2004, 01:29 PM
LouMalnati
external usenet poster
 
Posts: n/a
Default


The form never displays

-----Original Message-----
Lou,

When you say "it never loads", do you mean:
* the form displays but no controls are visible, or
* the form never displays.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-

0764559036.html


"Lou Malnati" wrote

in message
...
Please note the form WILL load if LoadData never gets

run
(eg. its a week-end). If LoadData gets called then for
some reason the form never loads even though I see the
OnLoad event ending (when I step-thru the code it gets

to
End Sub but the form never loads.)
Option Compare Database
Option Explicit

Private Sub Form_Load()
Call Form_Timer
End Sub

Private Sub Form_Timer()
'On Error GoTo frmstartup_err

Dim dteFileTme As Date
Dim dt As Long
Dim ErrorNumber
Dim strErrorMsg As String
Dim strErrBuild As String


strErrorMsg = "FormTimer Function Failed"

dteFileTme = Format((Now), "h:mm:s am/pm")
dt = WeekDay(Date)

Select Case dteFileTme
Case #7:00:00 AM# To #4:30:00 PM#
Select Case dt
Case 2 To 6
Case Else
Exit Sub
End Select
Case Else
Exit Sub
End Select
LoadData

Exit_He
On Error Resume Next


Exit Sub

frmstartup_err: ' Error-handling routine.

ErrorNumber = Err.Number
strErrBuild = chrErrorBody & " " & ErrorNumber &
strErrorMsg & ""
SendNotesMail chrErrorSubject, "", chrRecips,
chrCcRecips, chrbccRecips, strErrBuild, True
Resume Exit_Here




End Sub




-----Original Message-----
Hi,


The Timer would fire only when it is created, so, only

AFTER the form
hosting it is loaded.

==========================
Option Compare Database
Option Explicit

Private Sub Form_Load()
Debug.Print "Form_Load"
End Sub

Private Sub Form_Timer()
Debug.Print "Form_Timer"
Call Form_Load
End Sub
==========================

with a timer interval of 1000 prints, in the immediate

debug window, the
messages, as expected. Your setting does not

seem "clear"
to me, if it is
different, what is it, with code (just the relevant

parts)?



Hoping it may help,
Vanderghast, Access MVP



"LouMalnati"

wrote
in message
...
I call the OnTImer event when I load a form. Within

the
OnTimer Function I call another function called

Import
().
When the Import Function and OnTimer Function is

completed
and the code goes back to the original OnLoad event

and
the
the OnLoad even ends the form never loads.

I have stepped thru this sub several times and

confirmed
that it gets to "End Sub" within the OnLoad event,

but
it
never loads the form.

Any ideas ?


.



.

  #6  
Old August 18th, 2004, 03:02 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default

Lou,

Firstly, I think your code can be simplified somewhat, as shown below. Try
using this code before we look at anything else.

Also chrErrorBody, chrRecips, chrCcRecips, and chrbccRecips are not declared
anywhere; you might want to do declare and populate them before attempting
to run this procedure.

Private Sub Form_Timer()
'On Error GoTo frmstartup_err

Dim ErrorNumber
Dim strErrorMsg As String
Dim strErrBuild As String

strErrorMsg = "FormTimer Function Failed"

Select Case FormatDateTime(Now, vbShortTime)
Case #7:00:00 AM# To #4:30:00 PM#
If WeekDay(Date)-1 5 Then
LoadData
End If
End Select

Exit_He
'Prevent the event from re-firing
Me.TimerInterval = 0
Exit Sub

frmstartup_err: ' Error-handling routine.
ErrorNumber = Err.Number
strErrBuild = chrErrorBody & " " & ErrorNumber & strErrorMsg
SendNotesMail chrErrorSubject, "", chrRecips, _
chrCcRecips, chrbccRecips, strErrBuild, True
Resume Exit_Here
End Sub

Also, you're calling Form_Timer from within Form_Load. There's no need to do
that; if TimerInterval 0, the Timer event will fire without having to
explicitly call it. Once the Timer event has completed, set TimerInterval =
0, to stop the event re-firing. I've done this in the above code.

Private Sub Form_Load()
Me.TimerInterval = 1000
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyT...764559036.html


"LouMalnati" wrote in message
...

The form never displays

-----Original Message-----
Lou,

When you say "it never loads", do you mean:
* the form displays but no controls are visible, or
* the form never displays.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-

0764559036.html


"Lou Malnati" wrote

in message
...
Please note the form WILL load if LoadData never gets

run
(eg. its a week-end). If LoadData gets called then for
some reason the form never loads even though I see the
OnLoad event ending (when I step-thru the code it gets

to
End Sub but the form never loads.)
Option Compare Database
Option Explicit

Private Sub Form_Load()
Call Form_Timer
End Sub

Private Sub Form_Timer()
'On Error GoTo frmstartup_err

Dim dteFileTme As Date
Dim dt As Long
Dim ErrorNumber
Dim strErrorMsg As String
Dim strErrBuild As String


strErrorMsg = "FormTimer Function Failed"

dteFileTme = Format((Now), "h:mm:s am/pm")
dt = WeekDay(Date)

Select Case dteFileTme
Case #7:00:00 AM# To #4:30:00 PM#
Select Case dt
Case 2 To 6
Case Else
Exit Sub
End Select
Case Else
Exit Sub
End Select
LoadData

Exit_He
On Error Resume Next


Exit Sub

frmstartup_err: ' Error-handling routine.

ErrorNumber = Err.Number
strErrBuild = chrErrorBody & " " & ErrorNumber &
strErrorMsg & ""
SendNotesMail chrErrorSubject, "", chrRecips,
chrCcRecips, chrbccRecips, strErrBuild, True
Resume Exit_Here




End Sub




-----Original Message-----
Hi,


The Timer would fire only when it is created, so, only
AFTER the form
hosting it is loaded.

==========================
Option Compare Database
Option Explicit

Private Sub Form_Load()
Debug.Print "Form_Load"
End Sub

Private Sub Form_Timer()
Debug.Print "Form_Timer"
Call Form_Load
End Sub
==========================

with a timer interval of 1000 prints, in the immediate
debug window, the
messages, as expected. Your setting does not

seem "clear"
to me, if it is
different, what is it, with code (just the relevant
parts)?



Hoping it may help,
Vanderghast, Access MVP



"LouMalnati"

wrote
in message
...
I call the OnTImer event when I load a form. Within

the
OnTimer Function I call another function called

Import
().
When the Import Function and OnTimer Function is
completed
and the code goes back to the original OnLoad event

and
the
the OnLoad even ends the form never loads.

I have stepped thru this sub several times and

confirmed
that it gets to "End Sub" within the OnLoad event,

but
it
never loads the form.

Any ideas ?


.



.



  #7  
Old August 19th, 2004, 02:13 PM
LouMalnati
external usenet poster
 
Posts: n/a
Default

I will try this today. Regarding the variables they are
global variables which are declared in another module. I
assume this is ok ?



-----Original Message-----
Lou,

Firstly, I think your code can be simplified somewhat, as

shown below. Try
using this code before we look at anything else.

Also chrErrorBody, chrRecips, chrCcRecips, and

chrbccRecips are not declared
anywhere; you might want to do declare and populate them

before attempting
to run this procedure.

Private Sub Form_Timer()
'On Error GoTo frmstartup_err

Dim ErrorNumber
Dim strErrorMsg As String
Dim strErrBuild As String

strErrorMsg = "FormTimer Function Failed"

Select Case FormatDateTime(Now, vbShortTime)
Case #7:00:00 AM# To #4:30:00 PM#
If WeekDay(Date)-1 5 Then
LoadData
End If
End Select

Exit_He
'Prevent the event from re-firing
Me.TimerInterval = 0
Exit Sub

frmstartup_err: ' Error-handling routine.
ErrorNumber = Err.Number
strErrBuild = chrErrorBody & " " & ErrorNumber &

strErrorMsg
SendNotesMail chrErrorSubject, "", chrRecips, _
chrCcRecips, chrbccRecips, strErrBuild, True
Resume Exit_Here
End Sub

Also, you're calling Form_Timer from within Form_Load.

There's no need to do
that; if TimerInterval 0, the Timer event will fire

without having to
explicitly call it. Once the Timer event has completed,

set TimerInterval =
0, to stop the event re-firing. I've done this in the

above code.

Private Sub Form_Load()
Me.TimerInterval = 1000
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-

0764559036.html


"LouMalnati" wrote

in message
...

The form never displays

-----Original Message-----
Lou,

When you say "it never loads", do you mean:
* the form displays but no controls are visible, or
* the form never displays.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-

0764559036.html


"Lou Malnati"

wrote
in message
...
Please note the form WILL load if LoadData never gets

run
(eg. its a week-end). If LoadData gets called then

for
some reason the form never loads even though I see

the
OnLoad event ending (when I step-thru the code it

gets
to
End Sub but the form never loads.)
Option Compare Database
Option Explicit

Private Sub Form_Load()
Call Form_Timer
End Sub

Private Sub Form_Timer()
'On Error GoTo frmstartup_err

Dim dteFileTme As Date
Dim dt As Long
Dim ErrorNumber
Dim strErrorMsg As String
Dim strErrBuild As String


strErrorMsg = "FormTimer Function Failed"

dteFileTme = Format((Now), "h:mm:s am/pm")
dt = WeekDay(Date)

Select Case dteFileTme
Case #7:00:00 AM# To #4:30:00 PM#
Select Case dt
Case 2 To 6
Case Else
Exit Sub
End Select
Case Else
Exit Sub
End Select
LoadData

Exit_He
On Error Resume Next


Exit Sub

frmstartup_err: ' Error-handling routine.

ErrorNumber = Err.Number
strErrBuild = chrErrorBody & " " & ErrorNumber &
strErrorMsg & ""
SendNotesMail chrErrorSubject, "", chrRecips,
chrCcRecips, chrbccRecips, strErrBuild, True
Resume Exit_Here




End Sub




-----Original Message-----
Hi,


The Timer would fire only when it is created, so,

only
AFTER the form
hosting it is loaded.

==========================
Option Compare Database
Option Explicit

Private Sub Form_Load()
Debug.Print "Form_Load"
End Sub

Private Sub Form_Timer()
Debug.Print "Form_Timer"
Call Form_Load
End Sub
==========================

with a timer interval of 1000 prints, in the

immediate
debug window, the
messages, as expected. Your setting does not

seem "clear"
to me, if it is
different, what is it, with code (just the relevant
parts)?



Hoping it may help,
Vanderghast, Access MVP



"LouMalnati"

wrote
in message
...
I call the OnTImer event when I load a form.

Within
the
OnTimer Function I call another function called

Import
().
When the Import Function and OnTimer Function is
completed
and the code goes back to the original OnLoad

event
and
the
the OnLoad even ends the form never loads.

I have stepped thru this sub several times and

confirmed
that it gets to "End Sub" within the OnLoad

event,
but
it
never loads the form.

Any ideas ?


.



.



.

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Log-in (form or event) Jackie General Discussion 7 July 21st, 2004 04:52 PM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM
Load form, print it, close it. Ynot New Users 7 June 28th, 2004 08:22 PM
Update or CancelUpdate without AddNew or Edit Brad Marshall Using Forms 5 June 25th, 2004 04:45 AM
Recordset in subform based on field in parent form Lyn General Discussion 15 June 14th, 2004 03:10 PM


All times are GMT +1. The time now is 02:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.