[AccessD] Exporting help requested

MartyConnelly martyconnelly at shaw.ca
Tue Feb 6 15:11:48 CST 2007


You might try using the Data Shape Provider. It was first included
I think in MDAC ADO 2.1. There are .chm help files but also several
explanatory Papers on MSDN and Knowledge Base. Look under hierachical
recordsets or DataShape. I find it useful for aggregate grouping.
You could display with old VB6 Hierarchical Flexgrid control

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmscaccessingrowsinhierarchicalrecordset.asp

Data shaping provides a way to query a data source and return
a Recordset that represents a parent-child relationship between
two or more logical entities (a hierarchy). A classic example of
a hierarchical relationship is customers and orders.
For every customer in a database, there can be zero or more orders.
Regular SQL provides a means of retrieving the data using
JOIN syntax, but this can be inefficient and unwieldy because
redundant parent data is repeated in each record returned for
a given parent-child relationship. Data shaping can relate a
single parent record in the parent recordset to multiple child
records in the child recordset, avoiding the redundancy of a JOIN.


Example

Dim cnn As New ADODB.Connection
cnn.Provider = "MSDataShape"
cnn.Open "Data Provider=MSDASQL;DSN=vfox;uid=sa;pwd=vfox;database=Pubs"
. . .
rs1.Open "SHAPE {select * from Customers} " & _
         "APPEND ({select * from Orders} AS chapOrders " & _
         "RELATE CustomerID to CustomerID)", cnn


ewaldt at gdls.com wrote:

>I have a database with a self-related table. I'll use a simplified example 
>table:
>
>PartNumber
>PartDescription
>Parent
>Qty
>
>As should be obvious from the field names, the PartNumber is related as a 
>child to its given Parent.
>
>Access is not to be the database for this project (sorry for the 
>blasphemy; it's not my idea). There is a vertical application DB (I'll 
>call it VADB) with CAD-type capabilities that Access does not possess 
>(OTOH, the rest of the VADB is 80s technology; it's run in a DOS window, 
>and minimum requirements include DOS 5 and a 386!). I am trying to use 
>Access as an intermediary to convert data from a UNIX flat file to this 
>VADB. I need to produce a text file in the format the VADB requires for 
>importing.
>
>The target file would look like this, with each line below representing a 
>line in the target file:
>
>Parent (and all data on the parent)
>.Child (and all data on the child)
>.Child (and all data on the child)
>..Grandchild (and all data on the grandchild)
>.Child (and all data on the child)
>
>And so forth. The leading dots are necessary, although I could probably 
>insert those manually or export the whole puppy to Excel and have Excel do 
>it via VBA. The main point is that all of the lineage has to be included. 
>That is, all of the "grandchildren" have to appear every time they're in a 
>"child'; if the original table has only 200 records, the resulting target 
>file could easily have over 1000, with many of the records repeated many 
>times.
>
>The closest I've come is to create a report grouped by the Parent and 
>export it to Excel. However, this only goes down one level, and does not 
>include the leading dots, of course. Is there a way to have Access go down 
>all levels? Is there a better way to do the whole thing?
>
>TIA,
>
>Tom Ewald
>GDLS
>
>
>
>
>
>
>
>
>
>
>
>Thomas F. Ewald
>FCS Database Manager
>General Dynamics Land Systems
>(586) 276-1256
>
>
>
>
>
>This is an e-mail from General Dynamics Land Systems. It is for the intended recipient only and may contain confidential and privileged information.  No one else may read, print, store, copy, forward or act in reliance on it or its attachments.  If you are not the intended recipient, please return this message to the sender and delete the message and any attachments from your computer. Your cooperation is appreciated.
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada




More information about the AccessD mailing list