×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

yes no

yes no

(OP)
How can I make a text statement appear based on the value of my yes no box.
Example
yes I would like the statement "normal" to appear in textbox named result.
no I would like to type in a stament into textbox named result.

Thanks for any info!

RE: yes no

You just need a simple if statement on the 'after update' event of the yes/no box.

If me.yesornobox = true then
     me.result = "normal"
else
     me.result.setfocus
end if


Mike Rohde
rohdem@marshallengines.com

RE: yes no

(OP)
Thanks, perhaps you can help me with another question. I have a field in my form that I dont want a user to accidently change. I would like to send them a warning if the feild has data in it that they are about to change existing data. I thought an on enter event would work but I dont know how to make a message box appear giving them the option of backing out without changing things. Do you have any ideas?

RE: yes no

You could just have a message box on the on enter or the on got focus event that warns them before they have a chance to change anything.  Or maybe set the text box's enabled property to false and have a button that unlocks that textbox....

onclick
me.textbox.enabled = true.


Mike Rohde
rohdem@marshallengines.com

RE: yes no

If you use an Enter or GotFocus event to interrupt the user with a message box, I hope this is the last field on the form, because otherwise they'll get annoyed with you every time they want to tab through to the next field without typing anything!

How about using the Change event instead? Then you won't interrupt them unless and until they really do try to change the data.

Example for a text box named "txtProtect"

In the form module Declarations section:

    dim boolArmed As Boolean

In the Form_Current event procedure:

    boolArmed = Not IsNull(txtProtect)

In the txtProtect_Change event procedure:

    If boolArmed Then
        boolArmed = False
        RunCommand acCmdUndo
        Beep
        MsgBox "Warning: You are about to change existing data!", vbExclamation
    End If


Whenever the user navigates to a record, the Current event procedure arms the warning message if the field is not blank. Then, when the first keystroke is hit to type into the field, the Change event procedure first disarms the warning (to allow subsequent typing to succeed), cancels the typing (with an Undo command) and then warns the user. By doing the Undo command first, the original data is restored so the user has a second chance to see what it was before it was changed.

RE: yes no

(OP)
Thanks guys I will give this a try!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close