My form runs great inside of VFP, but has errors running from the exe...

I have a form that uses a combo box for the user to select from. Their selection then is used as a basis for searching a table via a SELECT statement. The results of the SELECT statement are then written to a different table, where they are available for export as an xls file. It is searching an automotive customer info list by car make...

This works flawlessly within VFP, but from the compiled exe I get complaints that Object 'wholesale_form' can't be found. This is the name of the form that is housing the combo box, and it is otherwise on screen and functional. Here's the code for the 'search' button I made:

 

SET SAFETY OFF
makevalue = wholesale_form.combo3.value
SELECT dodge_sales_table.make, last_name, first_name, phone WHERE (dodge_sales_table.make = makevalue) FROM dodge_sales_table ;
INTO TABLE vmake
BROWSE
CLOSE TABLES

Any idea why it would work inside VFP but not as an exe Thanks!

 


 

 




Answer this question

My form runs great inside of VFP, but has errors running from the exe...

  • BS24x7

    You have to have a referebnce to the form, which has to be included in the EXE and instantiated.

    As you say that you code this in a method of a combobox that lives inside the form, then the easiest way to reference it is by using the containership refernce (parent of the combo).

    Either:

    ThisForm.combo3.value  && from other method of the form

    or

    This.value && from the combo control itself

    or

    This.Parent.value  && if for example you are in a child (contained) object.

     

    Also, using the old xBase command BROWSE in an Exe on a form is not recommended. You have much better control (and look) if you use a grid object instead.


     


  • LakshmiMugur

    Thank you again... like most things I've encountered so far in VFP, I'm sure this concern will be obvious and easy once I get my mind wrapped around the terminology . Thank you for pointing out the other thread; I'll be sure to investigate the links you mentioned.  I'll check out the grid controls too. Thanks again!

  • ClaudeX

    I would suggest a quick trip to the Hentzenwerke web site where you can buy, and download, an e-book copy of "The Fundamentals" - although written for VFP Version 6.0, the basics are still sound and a lot of things that you are asking are explained in this book.

    It's still a good starting point!

    http://www.hentzenwerke.com/catalog/fund6.htm

     



  • jesus_

    OK. If you need basic instruction, you may be helped by reading the thread "create window" from today in this same forum. It has pointers to tutorials and samples online an in VFP itself. Start by looking at "solution samples".

    You said above that you have a form. That form has a combo box., right This is basically an object contained within the form. You place code in methods of the object (the form or the combobox itself). In those methods, you can reference any other live object by referencig the containership. Therefore a combo in a form can reference the form as: ThisForm.property or This.Parent.Property.

    If you type This and a dot, Intellisense should kick in, as long as the object is live or referenced and guide you to the PEMS (Properties, Methods, Events) of the object.

    HTH

     


  • Christen

    Thanks for the reply! Much appreciated! Now... if I only knew what your answer meant I'd be good to go! Do you speak noobie :)

  • My form runs great inside of VFP, but has errors running from the exe...