Consulting

Results 1 to 3 of 3

Thread: New to VBA need help!!

  1. #1
    VBAX Regular
    Joined
    Mar 2010
    Posts
    6
    Location

    New to VBA need help!!

    Ok there are 2 things I'm trying to do and can't figure out.

    Question 1: how do I make a command buttons click event do different things each time it's clicked? For example, I am making a command button that will turn a forms edit option on (I defaulted it "off") and that works fine but I need the button to then turn the edit option back off when clicked again. I need this button to go back and forth between edit on and edit off.

    Question 2: I am making a command button that will auto fill "city" "state" "zip" and "country" with predetermined values. I am making a yes/no message box that pops if there is already data in those text box's that asks the user if they really want to change those text box's to their own input. Here's my problem, I have everything coded except the "no" button on the message box. How do I allow the user to click "no" and have the text box disregard what the user input and go back to what was there to begin with?

    Thank you in advance for the help!!

  2. #2
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    Don't post the same question in multiple threads and please be patient. Most of us who help out here are working stiffs who generally check it only during work hours, so weekend questions aren't answered until the weekday most of the time.

    Hope my answer in your other thread helps you solve your problems
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  3. #3
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    1)Make a global boolean in the module
    2)Set it to false on load
    3)set it to true when button is clicked
    4)create if then logic for turning edit off and on based on boolean
    Just for the flair of it maybe you could try to:
    5)Change the text on the button: Edit if it's locked, Update if it's unlocked.
    this way future generations won't be wondering where the magic occurs.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

Posting Permissions

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