Discussion:
On Load event not working
(too old to reply)
Brian S
2011-03-08 04:18:20 UTC
Permalink
Hi,
Using Access 97 on Windows XP, I have a very simple On Load event
procedure not working - neither on the Design Master nor on a replica on
another laptop. I have Office 2003 (inc Access 2003) and Access97 (the one I
use) in separate folder.

Private Sub Form_Load()

'DoCmd.GoToRecord , , acLast
Call update_cbxBlock

Exit_Form_Load:
Exit Sub

Err_Form_load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub



This did work one or two computers ago - more or less same environment. All
help gratefully received.
John Spencer
2011-03-08 13:34:30 UTC
Permalink
What does "not working" mean?

Do you get error messages?
Does the wrong thing happen?
Does nothing happen?

Hopefully, you have split the database into a front end (forms, code, reports,
queries, macros) and back end (the data tables). Your back end should be
replicated.

Hopefully, you are not using replication for the front end as that does not
work well and tends to cause problems.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Post by Brian S
Hi,
Using Access 97 on Windows XP, I have a very simple On Load event
procedure not working - neither on the Design Master nor on a replica on
another laptop. I have Office 2003 (inc Access 2003) and Access97 (the one I
use) in separate folder.
Private Sub Form_Load()
'DoCmd.GoToRecord , , acLast
Call update_cbxBlock
Exit Sub
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
This did work one or two computers ago - more or less same environment. All
help gratefully received.
Brian S
2011-03-08 20:46:08 UTC
Permalink
Thanks for the reply. "not working " means nothing happens - no error
message. The database is not split - I had been hesitant to try that - never
having done it. The procedure is meant to open form "frmDailyRecords" to the
latest entry - there are about 2,000 records.

Brian S.
Post by John Spencer
What does "not working" mean?
Do you get error messages?
Does the wrong thing happen?
Does nothing happen?
Hopefully, you have split the database into a front end (forms, code,
reports, queries, macros) and back end (the data tables). Your back end
should be replicated.
Hopefully, you are not using replication for the front end as that does
not work well and tends to cause problems.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Post by Brian S
Hi,
Using Access 97 on Windows XP, I have a very simple On Load event
procedure not working - neither on the Design Master nor on a replica on
another laptop. I have Office 2003 (inc Access 2003) and Access97 (the one I
use) in separate folder.
Private Sub Form_Load()
'DoCmd.GoToRecord , , acLast
Call update_cbxBlock
Exit Sub
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
This did work one or two computers ago - more or less same environment. All
help gratefully received.
Douglas J Steele
2011-03-09 01:00:40 UTC
Permalink
Are you certain that the code is firing? It's not unheard of for procedures
to get disassociated from the events to which they're supposed to
correspond.

Look at the properties for the form. Does the On Load property contain
[Event Procedure]? If it does, are you taken into the middle of that code in
the VB Editor when you click on the ellipsis (...) to the right of the
property?

"Brian S" wrote in message news:BAwdp.32417$***@newsfe09.iad...

Thanks for the reply. "not working " means nothing happens - no error
message. The database is not split - I had been hesitant to try that - never
having done it. The procedure is meant to open form "frmDailyRecords" to the
latest entry - there are about 2,000 records.

Brian S.
Post by John Spencer
What does "not working" mean?
Do you get error messages?
Does the wrong thing happen?
Does nothing happen?
Hopefully, you have split the database into a front end (forms, code,
reports, queries, macros) and back end (the data tables). Your back end
should be replicated.
Hopefully, you are not using replication for the front end as that does
not work well and tends to cause problems.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Post by Brian S
Hi,
Using Access 97 on Windows XP, I have a very simple On Load event
procedure not working - neither on the Design Master nor on a replica on
another laptop. I have Office 2003 (inc Access 2003) and Access97 (the one I
use) in separate folder.
Private Sub Form_Load()
'DoCmd.GoToRecord , , acLast
Call update_cbxBlock
Exit Sub
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
This did work one or two computers ago - more or less same environment. All
help gratefully received.
Brian S
2011-03-09 04:47:56 UTC
Permalink
Yes to both questions. The On Load property does contain
[Event Procedure] and the ellipsis does take you to the code.Wheather the
code actually fires, I don't know how to tell.

Brian S.
Post by Douglas J Steele
Are you certain that the code is firing? It's not unheard of for
procedures to get disassociated from the events to which they're supposed
to correspond.
Look at the properties for the form. Does the On Load property contain
[Event Procedure]? If it does, are you taken into the middle of that code
in the VB Editor when you click on the ellipsis (...) to the right of the
property?
Thanks for the reply. "not working " means nothing happens - no error
message. The database is not split - I had been hesitant to try that - never
having done it. The procedure is meant to open form "frmDailyRecords" to the
latest entry - there are about 2,000 records.
Brian S.
Post by John Spencer
What does "not working" mean?
Do you get error messages?
Does the wrong thing happen?
Does nothing happen?
Hopefully, you have split the database into a front end (forms, code,
reports, queries, macros) and back end (the data tables). Your back end
should be replicated.
Hopefully, you are not using replication for the front end as that does
not work well and tends to cause problems.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Post by Brian S
Hi,
Using Access 97 on Windows XP, I have a very simple On Load event
procedure not working - neither on the Design Master nor on a replica on
another laptop. I have Office 2003 (inc Access 2003) and Access97 (the one I
use) in separate folder.
Private Sub Form_Load()
'DoCmd.GoToRecord , , acLast
Call update_cbxBlock
Exit Sub
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
This did work one or two computers ago - more or less same environment. All
help gratefully received.
Rick Brandt
2011-03-09 12:12:07 UTC
Permalink
Post by Brian S
Yes to both questions. The On Load property does contain
[Event Procedure] and the ellipsis does take you to the code.Wheather the
code actually fires, I don't know how to tell.
Your original code as posted has the first line commented out. Is that
it?
Post by Brian S
Post by Brian S
Private Sub Form_Load()
'DoCmd.GoToRecord , , acLast
Call update_cbxBlock
Exit Sub
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
Brian S
2011-03-09 20:00:21 UTC
Permalink
Thank you Rick. I had not noticed that - another lesson on why i should
write more notes. Removing the comma gives a run time error so I must have
done this some time ago and forgotten. This is my payroll program and I only
work on it every few years. I may be back to ask for help with that problem
later but for now thans again.
Post by Rick Brandt
Post by Brian S
Yes to both questions. The On Load property does contain
[Event Procedure] and the ellipsis does take you to the code.Wheather the
code actually fires, I don't know how to tell.
Your original code as posted has the first line commented out. Is that
it?
Post by Brian S
Post by Brian S
Private Sub Form_Load()
'DoCmd.GoToRecord , , acLast
Call update_cbxBlock
Exit Sub
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
Access Developer
2011-03-09 22:50:27 UTC
Permalink
Wheather the code actually fires,
I don't know how to tell.
Put a MsgBox statement in the Event Procedure. If it pops up, then the code
actually fired.

You could do something similar with Debug.Print, but that may be a little
more trouble.

Larry Linson
Microsoft Office Access MVP
Brian S
2011-03-10 06:07:10 UTC
Permalink
Post by Access Developer
Wheather the code actually fires,
I don't know how to tell.
Put a MsgBox statement in the Event Procedure. If it pops up, then the
code actually fired.
You could do something similar with Debug.Print, but that may be a little
more trouble.
Larry Linson
Microsoft Office Access MVP
Thanks Larry L., that's a handy trick.

Loading...