F
flores
I am getting the following error for the AfterUpdate event procedure of a
frame:
Compile error: Procedure declaration does not match description of event or
procedure having the same name
The frame holds three option buttons and a text box. The error started when
I added the optional Initialize variable as an argument to the event
procedure. My question is what should I do to make Access recgnize the added
argument to the event procedure? I know that the work around this to declare
a global variable, but I readly like to have Access 2002 recognize the added
optional Intialize varibale, to the event procedure declaration. Is there a
way to do this?
This is the complete event procedure that I am using:
Private Sub frmCost_Object_Type_AfterUpdate(Optional Initialize = True)
Me.frmCost_Object_Type.SetFocus
If Initialize Then
txtCost_Object.Value = Empty ' intializing here is a problem if the
record is being edited.
End If
Select Case frmCost_Object_Type.Value
'Note: option one is not visible because charges to cost centers currenly
are not used.
Case 1
' ' Receiver CCtr currently is not used--no list is associated at
this point.
' txtCost_Object.RowSource = ""
lblCost_Object.Caption = "Select Cost" & vbCrLf & "Center to charge"
' txtCost_Object.Value = Empty
' txtCost_Object.RowSource = "Select [Old Cost Center], [Stat Order
#],Description FROM [Hospital - Stat Order #] WHERE Description Like ""R&D
non Project related activities"" ORDER BY [Old Cost Center] ASC;"
txtCost_Object.RowSource = "SELECT [Hospital - Stat Order #].[Old
Cost Center], [Hospital - Stat Order #].[Stat Order #], [Hospital - Stat
Order #].Description " _
& "FROM [Hospital - Stat Order #] " _
& "WHERE ((([Hospital - Stat Order
#].Description) Like ""*non Project related activities*"")) " _
& "ORDER BY [Hospital - Stat Order
#].[Old Cost Center];"
txtCost_Object.ColumnWidths = "0.8 in;0 in; 3 in"
txtCost_Object.BoundColumn = 1 ' null
txtCost_Object.LimitToList = True
txtCost_Object.ListRows = 5
txtCost_Object.ColumnCount = 1
txtCost_Object.ListWidth = 3.8 * 1440 'convert to inches.
Case 2
lblCost_Object.Caption = "Select Stat" & vbCrLf & "Order Number"
' txtCost_Object.Value = Empty ' intializing here is a problem if
the record is being edited.
txtCost_Object.RowSource = "SELECT [Hospital - Stat Order #].[Stat
Order #], [Hospital - Stat Order #].[Projects / Territories] FROM [Hospital -
Stat Order #];"
txtCost_Object.ColumnWidths = "0.8 in;3 in"
txtCost_Object.BoundColumn = 1
txtCost_Object.LimitToList = True
txtCost_Object.ListRows = 8
txtCost_Object.ColumnCount = 2
txtCost_Object.ListWidth = 4.3 * 1440 'convert to inches.
Case 3
lblCost_Object.Caption = "Select" & vbCrLf & "Project"
' txtCost_Object.Value = Empty
txtCost_Object.RowSource = "WBS - R&D Costs Project List"
txtCost_Object.ColumnWidths = "1.1 in;3 in"
txtCost_Object.BoundColumn = 1
txtCost_Object.LimitToList = True ' allow free input, until OnExit
event.
txtCost_Object.ListRows = 8
txtCost_Object.ColumnCount = 2
txtCost_Object.ListWidth = 4.1 * 1440 'convert to inches.
Case Else
End Select
Me.txtCost_Object = ""
End Sub
frame:
Compile error: Procedure declaration does not match description of event or
procedure having the same name
The frame holds three option buttons and a text box. The error started when
I added the optional Initialize variable as an argument to the event
procedure. My question is what should I do to make Access recgnize the added
argument to the event procedure? I know that the work around this to declare
a global variable, but I readly like to have Access 2002 recognize the added
optional Intialize varibale, to the event procedure declaration. Is there a
way to do this?
This is the complete event procedure that I am using:
Private Sub frmCost_Object_Type_AfterUpdate(Optional Initialize = True)
Me.frmCost_Object_Type.SetFocus
If Initialize Then
txtCost_Object.Value = Empty ' intializing here is a problem if the
record is being edited.
End If
Select Case frmCost_Object_Type.Value
'Note: option one is not visible because charges to cost centers currenly
are not used.
Case 1
' ' Receiver CCtr currently is not used--no list is associated at
this point.
' txtCost_Object.RowSource = ""
lblCost_Object.Caption = "Select Cost" & vbCrLf & "Center to charge"
' txtCost_Object.Value = Empty
' txtCost_Object.RowSource = "Select [Old Cost Center], [Stat Order
#],Description FROM [Hospital - Stat Order #] WHERE Description Like ""R&D
non Project related activities"" ORDER BY [Old Cost Center] ASC;"
txtCost_Object.RowSource = "SELECT [Hospital - Stat Order #].[Old
Cost Center], [Hospital - Stat Order #].[Stat Order #], [Hospital - Stat
Order #].Description " _
& "FROM [Hospital - Stat Order #] " _
& "WHERE ((([Hospital - Stat Order
#].Description) Like ""*non Project related activities*"")) " _
& "ORDER BY [Hospital - Stat Order
#].[Old Cost Center];"
txtCost_Object.ColumnWidths = "0.8 in;0 in; 3 in"
txtCost_Object.BoundColumn = 1 ' null
txtCost_Object.LimitToList = True
txtCost_Object.ListRows = 5
txtCost_Object.ColumnCount = 1
txtCost_Object.ListWidth = 3.8 * 1440 'convert to inches.
Case 2
lblCost_Object.Caption = "Select Stat" & vbCrLf & "Order Number"
' txtCost_Object.Value = Empty ' intializing here is a problem if
the record is being edited.
txtCost_Object.RowSource = "SELECT [Hospital - Stat Order #].[Stat
Order #], [Hospital - Stat Order #].[Projects / Territories] FROM [Hospital -
Stat Order #];"
txtCost_Object.ColumnWidths = "0.8 in;3 in"
txtCost_Object.BoundColumn = 1
txtCost_Object.LimitToList = True
txtCost_Object.ListRows = 8
txtCost_Object.ColumnCount = 2
txtCost_Object.ListWidth = 4.3 * 1440 'convert to inches.
Case 3
lblCost_Object.Caption = "Select" & vbCrLf & "Project"
' txtCost_Object.Value = Empty
txtCost_Object.RowSource = "WBS - R&D Costs Project List"
txtCost_Object.ColumnWidths = "1.1 in;3 in"
txtCost_Object.BoundColumn = 1
txtCost_Object.LimitToList = True ' allow free input, until OnExit
event.
txtCost_Object.ListRows = 8
txtCost_Object.ColumnCount = 2
txtCost_Object.ListWidth = 4.1 * 1440 'convert to inches.
Case Else
End Select
Me.txtCost_Object = ""
End Sub