473,406 Members | 2,356 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,406 software developers and data experts.

Mysterious errors with Event Procedure on one form

Every thing worked fine until all of a sudden, I get the following error
whenever I try to do anything on one of my forms that calls an Event
Procedure. I get the error as soon as the form opens because I have an
OnLoad event. If I take that out the form will open but I will get the same
error if I attempt anything else that will call and Event Procedure. I am
not having any issues with any other forms.

Error is:

The expression On Load you entered as the event property setting produced
the following error: Event procedure declaration does not match description
of event having the same name.

Prior to this problem, I was attempting to pass a variable from an unbound
control on the problem form to another form. I have since returned both
forms back to their original state (at least I think I have). Ive included
the code for the form that I'm having this problem with, if that might help.
Any suggestions?

Some items that might look suspicious to you:
EnableControls - this calls a module that disables the main form controls
until two combo boxes in the header have been used to select criteria. I
borrowed the code from MS Solutions database. This worked prior to this
problem and has not been altered.

Code follows:

Private Sub ClientID_Enter()
MsgBox "You cannot edit this field."
Me!ProjectLocation.SetFocus
End Sub

Private Sub Form_AfterUpdate()

' Requery SelectProduct combo box.
Me!SelectProject.Requery

End Sub

Private Sub Form_Load()
Me!SelectClient.SetFocus
EnableControls Me, acDetail, False
End Sub

Private Sub Project_Enter()
MsgBox "You cannot edit this field."
Me!ProjectLocation.SetFocus
End Sub

Private Sub RefreshClient_Click()

' Requery SelectClient combo box.
Me!SelectClient.Requery

End Sub

Private Sub RefreshProjectID_Click()

' Requery SelectProject combo box.
Me!SelectProject.Requery

End Sub

Private Sub SelectClient_AfterUpdate()

' Enable and requery SelectProduct combo box.
' Disable controls in detail section.

Me!SelectProject.Enabled = True
Me!SelectProject.Requery
EnableControls Me, acDetail, False
End Sub

Private Sub SelectClient_DblClick(Cancel As Integer)
On Error GoTo Err_SelectClient_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmClients"
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acWindowNormal

Exit_SelectClient_DblClick:
Exit Sub

Err_SelectClient_DblClick:
MsgBox Err.Description
Resume Exit_SelectClient_DblClick

End Sub

Private Sub SelectProject_AfterUpdate()

' Find record for product selected in SelectProduct combo box.
' Enable controls in detail section and disable ProductID text box.
' Go to SupplierID combo box.

DoCmd.ApplyFilter , "ProjectID = Forms!frmWorksheet!SelectProject"
EnableControls Me, acDetail, True
Me!ProjectID.Enabled = False
Me!ProjectLocation.SetFocus
End Sub

Private Sub SelectProject_BeforeUpdate(Cancel As Integer)
If IsNull([SelectProject]) Then
MsgBox "You must select a project."
Cancel = True
End If

End Sub

Private Sub SelectProject_DblClick(Cancel As Integer, NewData As String)
On Error GoTo Err_SelectProject_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewProject"
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acWindowNormal
'DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acDialog,
"[ClientID] = [ClientID}"
'DoCmd.OpenForm stDocName, , , , , , Me!SelectClient.Column(3)
'DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acDialog, NewData

Exit_SelectProject_DblClick:
Exit Sub

Err_SelectProject_DblClick:
MsgBox Err.Description
Resume Exit_SelectProject_DblClick

End Sub
May 14 '06 #1
1 2040
Sorry, I spoke too soon. Just figured out what the problem was (although not
why). A friend suggested I CAREFULLY study the code to see if the syntax was
wrong somewhere. It wasn't syntax exactly but...

In the following sub, I was trying different methods to accomplish the info
transfering thing and then commented out the code when I tried something
new. Unfortunately a piece from the last comment line (the one that ends in
NewData) was left behind; "NewData As String" in the declarations. I deleted
this bit and the form works fine now. I don't understand why, when I used
the last line as code, I didn't have any trouble, but with it commented out,
the declaration line gave me trouble.

Private Sub SelectProject_DblClick(Cancel As Integer, NewData As String)
On Error GoTo Err_SelectProject_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewProject"
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acWindowNormal
'DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acDialog,
"[ClientID] = [ClientID}"
'DoCmd.OpenForm stDocName, , , , , , Me!SelectClient.Column(3)
'DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acDialog, NewData

Exit_SelectProject_DblClick:
Exit Sub

Err_SelectProject_DblClick:
MsgBox Err.Description
Resume Exit_SelectProject_DblClick

End Sub

May 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Coral Snake | last post by:
I am having problems with programming even simple "Hello World" programs from books and tutorials that use Python GUI libraries. Such Programs cause python to throw "Attribute Errors" even when the...
2
by: M Wells | last post by:
Hi All, I'm trying to track down a mysterious problem we're experiencing in which updates and inserts to tables in our mssql2k server appear to be 'disappearing.' To explain our situation: ...
1
by: M Wells | last post by:
Hi All, Further to my previous long-winded question about a situation in which we appear to be mysteriously losing data from our mssql2k server. We discovered an update statement, in the...
1
by: damjanu | last post by:
Dear All; I have 3 issues 1) On some of my tables I have unique indexes, so that for example no two phone numbers can be the same. When user enters phone number that already exists, a scary...
13
by: Dr. Zharkov | last post by:
Hello. A problem in the following. In VB .NET 2003 we create the project and in file Form1.vb the following code is written down: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As...
5
by: Sergey | last post by:
Hi everyone, It looks like a mystery, but I hope there should be some explanation to the issue I experience. Once in a blue moon a random stored procedure stops working the way it was designed....
8
by: Jerry | last post by:
Hi, My app is controled by a treeview. Each node brings a subform for input and calculations to the front. The subforms are loaded as controls on the main form. Dim ctl As Control For Each...
16
by: Neil | last post by:
I am using Access 2003, and have an ongoing problem of every once in a while losing an event procedure for a form or control. The procedure's still in the code module, but the form or control's...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.