Results 1 to 3 of 3

Thread: Pop-Up Question

  1. #1
    Join Date
    Jun 2009
    Posts
    95

    Unanswered: Pop-Up Question

    I have a form with a subform that a user can input data into. I need to make a pop-up box with the following criteria for a field that is a percentage.

    If the percentage is >34%, display this message.
    If it is between 10% and 34%, display this message.

    I am completely blind when it comes to any kind of coding or setting up something like this, I don't even know if coding is required.

    Thanks for any help,
    CT

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    public function DisplaySnottyMessage() as long
    dim strMessage as string
    if MyControlName.value >34 then
    strMessage = "Oi buggerlugs here got more than 34%"
    else
    strMessage = "Ha ha this muppet got 34% or less"
    endif
    DisplaySnottyMessage = msgbox(strMessage,vbexclamation+vbyesno,"Smart Aleck Messaeg box from dBForums")
    end sub

    then place a call to that function wherever you feel its appropriate
    that could be in the forms before update, the controls before update or on change, the forms on current events

    the one thing to be aware of is that the function expects the specified control to store a number. eg 35 = 35%, not .35 not 35%

    however form a user interface perspective you need to be carefull in your choice of when to use message boxes, they can seriously piss users off if used indiscriminantly or inappropriately
    HTH
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so paste the code above into your forms code, open the code window in design mode

    then place a call to DisplaySnottyMessage in waht ever events are appropriate

    I'd suggest the controls on change event, and or the the controls on lost focus event. select the control in desing mode, right click for properties select the events or other tab and tick the appropriate event of double click the control in desing mode, select code

    you will probably need to do some changes to make it handle the % in the control

    but give it a go
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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