Link to home
Start Free TrialLog in
Avatar of CyprexxDev
CyprexxDevFlag for United States of America

asked on

Create a field definition file from VBA

Is there a way to create a field definition file (ttx) or XML schema file (XSD) from an ADO recordset in VBA?  I can create an XML file using

rst.save "C:\file.xml" adPersistXML

But I need to schema file in order to use Crystal Reports the way I need it.  You can do this in .NET, but I can't find a solution for VBA (VB 6.0)  Thanks!
Avatar of puppydogbuddy
puppydogbuddy

I think what you refer to as a field definition file is what MS refers to as a Schema.ini file for Microsoft Access.    
                 to make a schema.ini file from a db table
                  http://support.microsoft.com/kb/210001

                 to read a text file into a recordset using a schema.ini file
                 http://support.microsoft.com/kb/q149090/
Hope this helps.
Here is a good tutorial on exporting Access schema using XML:
                     http://articles.techrepublic.com.com/5100-6329_11-5035228.html
Avatar of CyprexxDev

ASKER

Your first link refers to schema.ini which is not what I need.  I need an XSD file.  Your second link provides this, but it's for use with Tables, Queries, etc...  I need to export an ADO recordset to an XSD file so this still will not work.  I have found a utility called xsd.exe which creates an XSD file from an XML file (which I can create from an ADO recordset), but this XSD file cannot be used in Crystal Reports - it tells me the file is not well formed.  

Moreover, I am going to have to do hundreds of these.  I'd think there was an easier way to connect Crystal Reports to an ADO recordset created in VBA code, but it seems they have nothing that works in this fashion which essentially makes CR useless for an Access or VB Application (unless the developer is using very simple techniques).  This is why I know something must exist, but nobody seems to know what it is.
ASKER CERTIFIED SOLUTION
Avatar of puppydogbuddy
puppydogbuddy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You might want to consider a commericial converter like this:
                     http://www.milestone.ca/access2crystal.asp?rmnu=Product&RetailSoftwareid=7#
                        free demo version allows you to convert 5 reports  ( costs $295 to buy full version)
That's almost exactly what I needed.  Thanks!  Access converters never work well, plus we don't have the original Access reports to convert (we're building this application from scratch based on the process flow of an existing aplpication).
Glad I could help.  
CyprexxDev,
Earlier tonight I happened to see your second post, but when I went back to try and read your request in detail, the post had been deleted.  Did you get what you needed from my answer above, or do you  need a different code set?
I figured out where to get the p2smon.dll file so I could create the TTX file from within my VBA code (based on an ADO recordset).  This pretty much has solved my problem.  I can get everything to work as needed now.  I'm sure I'll still have more questions as I go along though :-)  Thanks for all your help.