PDA

View Full Version : New to VBA need help!!



detowne
03-07-2010, 12:41 PM
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!!

CreganTur
03-08-2010, 08:09 AM
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 :thumb

Imdabaum
03-16-2010, 09:53 AM
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.