Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2003
    Posts
    4

    Unanswered: Showing messages

    How can I show a message in a form depending on the result of a calculation in that form.
    e.g. the result : <20 "text1" ; >=20 "text2" ; ......

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Code:
    If Result <20 Then 
       MsgBox "This is message text 1"
    ElseIf Result >= 20 then
       MsgBox "This is Message text 2"
    End If


  3. #3
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    First you need an event to trigger the code.
    On open? On exit? on click of a command button? It depends on when you want to display the message.

    then refer to the control that has the result. The following displays a msgbox for the user.

    if Me.MyCalculation < 20 then
    ....msgbox "text1"
    else
    ....msgbox "text2"
    end if
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  4. #4
    Join Date
    Dec 2003
    Posts
    4
    Originally posted by CyberLynx
    Code:
    If Result <20 Then 
       MsgBox "This is message text 1"
    ElseIf Result >= 20 then
       MsgBox "This is Message text 2"
    End If

    the text mustn't appear in an messagebox but needs to be on the form constantly in a textbaox near the result. Sorry for my wrong the bad explanation.

  5. #5
    Join Date
    Nov 2003
    Posts
    1,487
    Code:
    If Result <20 Then 
       Me.myTextBoxOnForm =  "This is message text 1"
    ElseIf Result >= 20 then
       Me.myTextBoxOnForm =  "This is Message text 2"
    End If

  6. #6
    Join Date
    Dec 2003
    Posts
    4

    Talking

    Originally posted by CyberLynx
    Code:
    If Result <20 Then 
       Me.myTextBoxOnForm =  "This is message text 1"
    ElseIf Result >= 20 then
       Me.myTextBoxOnForm =  "This is Message text 2"
    End If
    thanks folks !!!

  7. #7
    Join Date
    Nov 2003
    Location
    Riga, Latvia
    Posts
    36
    I would rather suggest something like

    =IIf([Result]<20;"Text1";"Text2" in the Control source of the "message" text box
    Replies based on my configuration: Windows XP / Microsoft Office Access 2003 unless specified otherwise.

  8. #8
    Join Date
    Nov 2003
    Posts
    1,487
    Someone, somewhere, sometime, on some planet, once said:

    "You must first learn to walk before you can run".

    Last edited by CyberLynx; 12-10-03 at 01:09.

Posting Permissions

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