Alpha Video Training
Results 1 to 2 of 2

Thread: Access to Alpha Challenge - Count relationships in Access database

  1. #1
    "Certified" Alphaholic kingcarol's Avatar
    Real Name
    Carol King
    Join Date
    Jun 2010
    Posts
    1,528

    Default Access to Alpha Challenge - Count relationships in Access database

    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.)
    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 Know the code to execute the next query in Alpha but am not putting it here in order to save space.)     
         sql = "INSERT INTO TblUtilRelationshipNamesInDataFile (RELATIONSHIP_TEXT)VALUES (" & "'" & Relationship & "'" & ")"
         'execute the query
    Next MyRelation
    Last edited by kingcarol; 07-22-2011 at 01:24 PM.
    Carol King
    Developer of Custom Homebuilders' Solutions (CHS)
    http://www.CHSBuilderSoftware.com

  2. #2
    "Certified" Alphaholic kingcarol's Avatar
    Real Name
    Carol King
    Join Date
    Jun 2010
    Posts
    1,528

    Default Re: Access to Alpha Challenge - Count relationships in Access database

    Just a point of interest. Here's how the records end up looking in the table that I am inserting the info into:
    http://screencast.com/t/Ck5cvK286U9
    Carol King
    Developer of Custom Homebuilders' Solutions (CHS)
    http://www.CHSBuilderSoftware.com

Similar Threads

  1. Alpha Web Server: Still unable to access database: Error opening Grid table/view: H
    By coyotemrh in forum Application Server Version 10 - Web/Browser Applications
    Replies: 12
    Last Post: 07-20-2010, 11:44 AM
  2. Converting MS Access 2007 database to Alpha Five Ver 9
    By chandran in forum Alpha Five Version 9 - Desktop Applications
    Replies: 15
    Last Post: 06-24-2008, 09:33 PM
  3. Importing Alpha database into Access
    By Bernard Portier in forum Alpha Five Version 5
    Replies: 3
    Last Post: 04-08-2004, 08:22 PM
  4. Linking an Access to an Alpha Five Database
    By Alastair in forum Alpha Five Version 5
    Replies: 2
    Last Post: 02-16-2004, 06:33 AM
  5. database access
    By A. R. Sale in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-12-2004, 10:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •