Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Moundridge, Kansas, USA
    Posts
    342
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Popup Message (Access 2003/SP 2)

    I would like to have a popup message appear for an inmate facility whenever the "Restrictions" in the Prisons address form is not null. As I'm entering an order, if the current prison has restrictions on what an inmate can receive, I'd like to have a message popup. I'm not sure how to do that.

    I tried using Form_AfterUpdate() with something like this:
    If (Me.Prison_Name="Whatever name") And (Me.State="Whatever State") Then
    MsgBox "Inmates can only receive 1 copy"
    and the rest of the msgbox requirements. That didn't work.

    Then I tried something like this:
    If (Me!Forms!Prison_Names.Restrictions=<>)Then.
    Well, I got lost there. I'd like to have whatever statement is in restrictions pop up.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Popup Message (Access 2003/SP 2)

    Try

    If Not IsNull(Me.Restrictions) Then
    MsgBox "Boo!"
    End If

    Note: the After Update event occurs when the record has already been updated. If you want to prevent the record from being saved, you should use the Before Update event of the form and set its Cancel argument to True:

    Private Sub Form_Update(Cancel As Integer)
    If Not IsNull(Me.Restrictions) Then
    MsgBox "Boo!"
    Cancel = True
    End If
    End Sub

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Moundridge, Kansas, USA
    Posts
    342
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Popup Message (Access 2003/SP 2)

    That didn't work. I probably didn't make myself clear. I need to refer to another form. i.e. the "Restrictions" field is in the Prison Names form and I am entering orders in the Prisons form. I would like if the "Restrictions" field is not null for the current prison, for it to pop up the message for that prison.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Popup Message (Access 2003/SP 2)

    Is the current record in the Prison Names form that of the prison for which you are entering a record in the Prisons form?

  5. #5
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Moundridge, Kansas, USA
    Posts
    342
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Popup Message (Access 2003/SP 2)

    Yes, sir.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Popup Message (Access 2003/SP 2)

    Try

    If Not IsNull(Forms![Prison Names]!Restrictions) Then
    MsgBox ...
    End If

  7. #7
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Moundridge, Kansas, USA
    Posts
    342
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Popup Message (Access 2003/SP 2)

    Thanks for that Hans. I'll have to try that another day. Got another project I have to get done.

Posting Permissions

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