Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help ! Create Grid
Message
 
To
26/03/2000 08:43:02
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00350518
Message ID:
00350534
Views:
22
>sorry it is my first time to write a program.I have this problem.
>In form i have a combo box, text box & button
>i want select "combo box" item & in text box input a number after that press a button to show i select item & number in the grid box.
>how to i write a code in a button. but i need to update the table record.How can i do it!
>Thank You Very Much.

Hi Cavin,

The best way would be to use a parameterized view as a source of your grid. Say, in combobox we select some category, and in a textbox- invoice number. The view SQL then could look like

SELECT * from myTable ;
WHERE mytable.category = lcCategory ;
AND mytable.invnumber = lnNumber ;

You set up the view in form Dataenvironment with NoDataOnLoad = .t. so it does not fill the view with data when you load the form. You also make your view updatable and make it Recordsource for your grid. Then in your button.Click() you put the code like:

lcCategory = this.parent.cboCategory.Value
lnNumber = this.parent.txtNumber.Value
=REQUERY("myView")
this.parent.myGrid.Refresh()

You should also issue Tableupdate() for your view when you need it to send teh updates to the table.

HTH,

Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform