Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Very strange error: event problems

    Hi--

    Acc97/Win95
    Has anyone seen this error before? It's as if the controls on the form won't recognize their own event procedures.

    "The Expression After Update you entered as the event property setting produced the following error: Event procedure declaration does not match description of event having same name."

    Now, the code in the event procedure isn't really much. I had a form built, and the code was quite happy. Then I tried to add one more control with similar code. The new control produced the above error. After checking it out, I thought maybe my database was corrupt. So I copied all of the objects into a new db. When I tried to open the form, none of the event procedures would work, including the OnLoad. I tried all variants of copying the form (aside from re-creating it from scratch), but it no longer works. A really old version of the form still works, though.

    Here's an example of the code:
    In On Load, I have Me.lstState.Value = Me.lstState.ItemData(0) (which is supposed to select the first item in my listbox, but it never did work).

    The code in the two combos is something like: Private Sub cboReport_AfterUpdate(Cancel As Integer)
    Dim ctl As Control
    'If it's a custom report, allow selections, but if it's canned, disable selections
    If cboReport = "Custom" Then
    For Each ctl In Me.Controls
    ctl.Enabled = True
    Next
    Else
    For Each ctl In Me.Controls
    If ctl.Name = "cboReport" Then
    ctl.Enabled = True
    Else
    ctl.Enabled = False
    End If
    Next
    End If
    End Sub

    Does anyone have any ideas?

    Thanks!

    Cecilia :-)

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Very strange error: event problems

    Get rid of the Cancel parameter; AfterUpdate event procedures don't take any parameters. You'll get that message whenever your event procedures don't have the correct number of parameters.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Very strange error: event problems

    Thank you thank you thank you!!!!!

    Just getting rid of that fixed everything else! I can't believe it! (You would think that a problem with one event procedure would only affect that one event procedure, but it affected the whole form! Go figure....)

    Thanks again,

    Cecilia :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •