Results 1 to 3 of 3

Thread: My Command Buttons Won't Work - NEED HELP!

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2011
    Posts
    4

    My Command Buttons Won't Work - NEED HELP!

    I am just about done my Price Analyzer, but I keep running into Run-Time and other errors when I click the "x" button when the forms comes up and when I click cancel.

    All I need to to be able to click "x" and have it not bring up and error and when the cancel button is clicked that the macro stops (so it doesn't do anything).

    I have attached a .txt file with the 3 needed scripts (module 1, Button_Cancel, and Button_Ok)

    I appreciate any help you can give!
    Attached Files Attached Files

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: My Command Buttons Won't Work - NEED HELP!

    Thread moved to the 'Office Development/VBA' forum... note that while it certainly isn't made clear, the "VB Editor" in Office programs is actually VBA rather than VB, so the 'VB6' forum is not really apt

  3. #3
    Addicted Member
    Join Date
    Jan 2009
    Posts
    183

    Re: My Command Buttons Won't Work - NEED HELP!

    After your line which shows the form, you pull data from the form fields. If the cancel button is clicked, you are exiting the form (instead of hiding it), so it is no longer available for the following lines (which is why you are getting an error - the fields no longer exist). You'd probably be better setting a boolean variable in the form when the user clicks OK, and checking that variable before continuing. If the variable is true, you can continue your priceanalyzer sub. If it's false then exit the sub. And you need to hide the form from both buttons, only close the form from your priceAnalyzer sub.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width