Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best approach to code form class?
Message
From
08/02/2002 12:10:43
 
 
To
08/02/2002 11:31:00
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00617445
Message ID:
00617507
Views:
20
This message has been marked as the solution to the initial question of the thread.
Inge,

You are asking about several things here, and I could write pages to address these issues. But I won’t, because entire chapters in books have been written that deal with these items. I still recommend that you get a book or two from www.hentzenwerke.com. Effective Techniques deals with these types of issues, but you need make sure you have a good foundation in VFP.

With that said, please see my inline comments...

>I have a FORM CLASS with FIELD CONTROLS to reflect values in tables 'myTable1' & 'myTable2' + COMMAND BUTTON CONTROLS: next, back, new, change, find. I'm currently using VFP tables, but will eventually convert to SQL.
>
>To populate the field controls, I have an SQL SELECT statement in my form class' LOAD event: SELECT * FROM myTable1 LEFT JOIN myTable2 ON myTable1.id=myTable2.ID into cursor xTable. I then would like to free up myTable1 & myTable2 (close them) so that if at any time I need to do a MODIFY STRUCTURE on myTable1 or myTable2, I can open the tables EXCLUSIVEly.

I don't think being able to MODIFY STRUCTURE on a table that is currently being referenced on a form is a "feature" you should concern yourself with at this time *grin*


>I have set the field controls' CONTROL SOURCE property to xTable.fieldname (where xmyTable = cursor created), as opposed to myTable1.fieldname & myTable2.fieldname (myTable1 & myTable2 should now be closed). So far, is that OK?
>

It is not okay, unless you only want to display data. There are many ways to work this situation:

-bind the table fields directly to the form controls. Learn about table buffering.
-updateable views
-use scatter/gather name, and put the data an object (a business object, for example)


>I'd like to avoid using 'USE myTable1', 'SET RELATION' etc. since I would be converting to SQL tables & those commands does not work with SQL tables (??). What is the preferred way to code the form class? I'd like to bring up the form with the first record in myTable1, and user then can then click on the NEXT or BACK command button to navigate through myTable1. If user click on the NEW button, the form takes in their data entry & upon clicking a SUBMIT button, updates data entered into myTable1. Do I set all field controls' CONTROL SOURCE to xmyTable.fieldname? This seems to work great if user just want to navigate through the table by clicking the NEXT & BACK command buttons. But what is the table is changed/updated by somebody else: user cannot see the changes?
>

Do your users really need (or want?) to navigate through the records one by one? Are there other ways the users can get to the data, such as lookup forms with lists?

>Is it not possible to use xmyTable.fieldname (cursor) to be able to see the changes in myTable? Must I use myTable.fieldname (table) instead?
>

Yes, or an updateable view...

>When user click on CHANGE or NEW button: what happens then? How do I make it so that user can update the current record? Is this not possible with using the cursor?
>
>Can anybody give me a clue what do I need to do?

Well, there is a lot to learn. I really suggest you have the resources you need...this website is invaluable, but it can't replace some of the VFP books that have been written.

HTH,
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform