Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    1

    Unanswered: BeforeUpdate issues - runtime error 2115

    Hello

    I'm a total novice with VBA/Access so would desperately appreciate some help!

    After making some amendments to an Access form I didn't set up, I came across a runtime error 2115 (about BeforeUpdate).

    I think that the code I have causes a further set of data input boxes to appear, dependent on whether 2 separate checkboxes are ticked or not. Anyway, the only thing I changed to the database that I can think of was adding an autonumber to the main table. It all seemed to be working before I did that.

    Any help on this is much appreciated. (and yes, I've learned my lesson and won't be touching somebody elses database again!!)

    Thanks.

    This is my code (I'm afraid I've posted it all as I don't know which bit is useful)

    Option Compare Database

    Private Sub Combo39_AfterUpdate()
    Refresh
    End Sub

    Private Sub Coroner_PM_BeforeUpdate(Cancel As Integer)
    If (Forms![Death Certificate DB]![Coroner PM] = False) Then
    Forms![Death Certificate DB]!Label22.Visible = True
    Forms![Death Certificate DB]!Label23.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(a)].Visible = True
    Forms![Death Certificate DB]!Label24.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(b)].Visible = True
    Forms![Death Certificate DB]!Label25.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(c)].Visible = True
    Forms![Death Certificate DB]!Label26.Visible = True
    Forms![Death Certificate DB]![Cause of Death 2].Visible = True
    Forms![Death Certificate DB]![Box21].Visible = True
    End If

    DoCmd.RunCommand acCmdRefresh

    If (Forms![Death Certificate DB]![Coroner PM] = True) Then
    Forms![Death Certificate DB]!Label22.Visible = False
    Forms![Death Certificate DB]!Label23.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(a)].Visible = False
    Forms![Death Certificate DB]!Label24.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(b)].Visible = False
    Forms![Death Certificate DB]!Label25.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(c)].Visible = False
    Forms![Death Certificate DB]!Label26.Visible = False
    Forms![Death Certificate DB]![Cause of Death 2].Visible = False
    Forms![Death Certificate DB]![Box21].Visible = False
    End If

    End Sub


    Private Sub Form_Current() 'NEW
    If (Forms![Death Certificate DB]![Coroner PM] = False) Then
    Forms![Death Certificate DB]!Label22.Visible = True
    Forms![Death Certificate DB]!Label23.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(a)].Visible = True
    Forms![Death Certificate DB]!Label24.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(b)].Visible = True
    Forms![Death Certificate DB]!Label25.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(c)].Visible = True
    Forms![Death Certificate DB]!Label26.Visible = True
    Forms![Death Certificate DB]![Cause of Death 2].Visible = True
    Forms![Death Certificate DB]![Box21].Visible = True
    End If

    If (Forms![Death Certificate DB]![Coroner PM] = True) Then
    Forms![Death Certificate DB]!Label22.Visible = False
    Forms![Death Certificate DB]!Label23.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(a)].Visible = False
    Forms![Death Certificate DB]!Label24.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(b)].Visible = False
    Forms![Death Certificate DB]!Label25.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(c)].Visible = False
    Forms![Death Certificate DB]!Label26.Visible = False
    Forms![Death Certificate DB]![Cause of Death 2].Visible = False
    Forms![Death Certificate DB]![Box21].Visible = False
    Else
    End If

    End Sub

    Private Sub Hospital_PM_AfterUpdate()

    If (Forms![Death Certificate DB]![Coroner PM] = False) Then
    Forms![Death Certificate DB]!Label22.Visible = True
    Forms![Death Certificate DB]!Label23.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(a)].Visible = True
    Forms![Death Certificate DB]!Label24.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(b)].Visible = True
    Forms![Death Certificate DB]!Label25.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(c)].Visible = True
    Forms![Death Certificate DB]!Label26.Visible = True
    Forms![Death Certificate DB]![Cause of Death 2].Visible = True
    Forms![Death Certificate DB]![Box21].Visible = True
    End If

    DoCmd.RunCommand acCmdRefresh

    If (Forms![Death Certificate DB]![Coroner PM] = True) Then
    Forms![Death Certificate DB]!Label22.Visible = False
    Forms![Death Certificate DB]!Label23.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(a)].Visible = False
    Forms![Death Certificate DB]!Label24.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(b)].Visible = False
    Forms![Death Certificate DB]!Label25.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(c)].Visible = False
    Forms![Death Certificate DB]!Label26.Visible = False
    Forms![Death Certificate DB]![Cause of Death 2].Visible = False
    Forms![Death Certificate DB]![Box21].Visible = False
    End If

    End Sub


    Private Sub Hospital_PM_BeforeUpdate(Cancel As Integer)
    If (Forms![Death Certificate DB]![Coroner PM] = False) Then
    Forms![Death Certificate DB]!Label22.Visible = True
    Forms![Death Certificate DB]!Label23.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(a)].Visible = True
    Forms![Death Certificate DB]!Label24.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(b)].Visible = True
    Forms![Death Certificate DB]!Label25.Visible = True
    Forms![Death Certificate DB]![Cause of Death 1(c)].Visible = True
    Forms![Death Certificate DB]!Label26.Visible = True
    Forms![Death Certificate DB]![Cause of Death 2].Visible = True
    Forms![Death Certificate DB]![Box21].Visible = True
    End If

    DoCmd.RunCommand acCmdRefresh

    If (Forms![Death Certificate DB]![Coroner PM] = True) Then
    Forms![Death Certificate DB]!Label22.Visible = False
    Forms![Death Certificate DB]!Label23.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(a)].Visible = False
    Forms![Death Certificate DB]!Label24.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(b)].Visible = False
    Forms![Death Certificate DB]!Label25.Visible = False
    Forms![Death Certificate DB]![Cause of Death 1(c)].Visible = False
    Forms![Death Certificate DB]!Label26.Visible = False
    Forms![Death Certificate DB]![Cause of Death 2].Visible = False
    Forms![Death Certificate DB]![Box21].Visible = False
    End If
    End Sub

    Private Sub Place_of_Death_AfterUpdate()
    Refresh
    End Sub

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    It would be very helpfull to know what the error states (the description of the error that is displayed).


    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


Posting Permissions

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