Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Same form different tables

Status
Not open for further replies.

reinaldo

Programmer
Mar 29, 2001
31
0
0
US
I created a form with code. "Sales Tax" There are 3 tables on the form. A Data Model of Customer, Qtrtax, Taxitem. We entered the records for 2001 for all of our customers.

Now I would like to enter records for 2002 in different tables. The customer table is always the same.

Can I set this form up in such a way that I can use the same tables however keep the customer table in one directory and the other two tables in different directories, as in (2001 2002) so that with the same form I can view or post the 2001 information or the 2002 information?


Thanks All
 
Yes.
The solution lies in aliases. The idea is that you ONLY refer to tables using an alias + TableName. E.G. set up an alias called ":CURYEAR:". Initailly, you can map this alias to the folder named 2001. In code, when initialising the application (e.g. opening Paradox) set the :CURYEAR: alias to point to whatever folder you wish (2001, 2002, ..) using the setAlias procedure (see Help). That way the form or code will not need to be modified for future years.
HTH
Padraig
 
The alias point is correct, but I think it falls short of what you want to do. I guess you want to be able to look at either table from the same form at the click of a button, without reloading paradox. You can do this by changing the tablename value of each field with OPAL. For example, you have a picklist of years 2001,2002, etc... and your table names correspond (2001.db, 2000.db). Pick the year you want, then click a pushbutton. In the buttons pushbutton event, add code to change the tablename value of each field that you want affected.

code------
var
holdingName string
endvar

holdingName = yearpicklist.value+".db"

Myfield1.tablename = holdingName
Myfield2.tablename = holdingName
etc...


endcode------

Not too elegant I agree, but quick and dirty.


Mac





 
Ooops. Forgot, if your fields are in a multi-record object, you need only change that objects tablename value and save yourself a lot of coding.

Mac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top