Here's a challenge. I need to check the relationships integrity of my back end Access database that Alpha is connected to.
One way I do that is to count that the number of table relationships is the number it should be.
After executing the following code in Access, I then do a count query to check the number of records in the table
that has received the relationship info. In the Access code below, I get the relationships info and then
insert all the table names that have relationships AND the primary field names in parent AND child field names in foreign table
INTO a table named TblUtilRelationshipNamesInDataFile.
The challenge is to figure out how to do the same thing in Xbasic. I think I need to use the info here:
http://wiki.alphasoftware.com/AlphaD...aDAO+Reference
but can't get it figured out. Any gurus out there that can give me some pointers?
Here's the code in Access: (The connection has already been established with a dbs variable dimmed as Database. In Alpha, I would be establishing a connection with cn variable.)
One way I do that is to count that the number of table relationships is the number it should be.
After executing the following code in Access, I then do a count query to check the number of records in the table
that has received the relationship info. In the Access code below, I get the relationships info and then
insert all the table names that have relationships AND the primary field names in parent AND child field names in foreign table
INTO a table named TblUtilRelationshipNamesInDataFile.
The challenge is to figure out how to do the same thing in Xbasic. I think I need to use the info here:
http://wiki.alphasoftware.com/AlphaD...aDAO+Reference
but can't get it figured out. Any gurus out there that can give me some pointers?
Here's the code in Access: (The connection has already been established with a dbs variable dimmed as Database. In Alpha, I would be establishing a connection with cn variable.)
Code:
Dim MyRelation As DAO.Relation Dim Relationship For Each MyRelation In dbs.Relations Relationship = MyRelation.Table & "." & MyRelation.Fields(0).Name & "|" & MyRelation.ForeignTable & "." & MyRelation.Fields(0).ForeignName [I]'(I Know the code to execute the next query in Alpha but am not putting it here in order to save space.)[/I] sql = "INSERT INTO TblUtilRelationshipNamesInDataFile (RELATIONSHIP_TEXT)VALUES (" & "'" & Relationship & "'" & ")" 'execute the query Next MyRelation
Comment