Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
2 Form classes, same parent class, same codes, diff. tab
Message
From
22/12/2005 10:43:57
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01080098
Message ID:
01080176
Views:
11
This message has been marked as a message which has helped to the initial question of the thread.
>Hi Hilmar
>
>>Yes, you can open two different tables with the same alias.
>
>Thanks a lot. I was just thinking this logic is more related to making into a class, maybe a custom/line class to handle just this logic.

There is yet another way, more appropriate for a more generic custom class, for example, one that handles a standard data view/search/edit form for simple tables:

Store the table/alias name in a form property. Open the table with that alias, and use the form property in generic code, instead of hard-coding the alias. For example:
* Delete selected record in main table
select (ThisForm.cMainAlias) && Just in case you selected another table
delete
if not TableUpdate()
  aerror(...)
  MessageBox("Can't delete record." + ...)
  ...
endif
In your specific instances (forms derived from the class), set the corresponding form property or properties, open the table with a specific alias, set the RecordSource for the Grid, ControlSources for TextBoxes, etc.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform