Results 1 to 15 of 15
  1. #1
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    Unanswered: Acces 97 and XML

    any way to export 97 table to xml

    so far it seems the only way to do this is feed the data fields into a predefined text file with flags and refs and to rename as myfile.xml

    it is clugy but it works.

    any better suggestions?
    Dale Houston, TX

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Linky
    2002 onwards I'm afraid!
    George
    Home | Blog

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I wonder if upgrading the MDAC or possibly using a 3rd party driver will help. I know in the past I've used 3rd party drivers and were able to import/export in ways I normally could not do with the version of Access.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    Filesystem object

    I used the file system object to create the out put files and to also read the reply files coming in. Works great actually. After all they are only text files.

    But I did find an interesting link for Access 2000 and greater.

    http://www.vb123.com/toolshed/01_docs/accessxml.htm

    Not trying to advertise here - but for any users that do not use VBA - this might help with XML
    Dale Houston, TX

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I'd be interested in your FSO code to read XML files - fancy posting a snippet or two?
    ~ George
    George
    Home | Blog

  6. #6
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    Code to create and read xml files

    Code:
    Public Function MakeXMLFile()
    
    
    Dim fso As New FileSystemObject
    Dim txtstr As TextStream
    Set txtstr = fso.CreateTextFile("f:\testingcard\MyXML.xml", True)
    
    Dim myccfrmpos, myexpdate, mycardholder, myflag, myamount, mytrackdata, mycommand, mycc
    
    
    mycc = Forms!formname!txtNumber
    myexpdate = Forms!formname!txtExpDate
    mycardholder = Forms!formname!txtCard
    myflag = AnotherFunction()
    myamount = Forms!formname!txtAmount
    mytrackdata = Forms!formname!txtTrack
    mycommand = 1
    
        With txtstr
            .WriteLine "<XML_FILE>"
            .WriteLine "<XML_REQUEST>"
            .WriteLine "<COMMAND>" & mycommand & "</COMMAND>"
            .WriteLine "<ACCT_NUM>" & mycc & "</ACCT_NUM>"
            .WriteLine "<EXP_DATE>" & myexpdate & "</EXP_DATE>"
            .WriteLine "<MANUAL_FLAG>" & myflag & "</MANUAL_FLAG>"
            .WriteLine "<Trans_amount>" & myamount & "</trans_amount>"
            .WriteLine "<TRACK_DATA>" & mytrackdata & "</TRACK_DATA>"
            .WriteLine "<CARDHOLDER>" & mycardholder & "</CARDHOLDER>"
            .WriteLine "</XML_REQUEST>"
            .WriteLine "</XML_FILE>"
       End With
    
    
        
    End Function
    
    Public Function ReadXMLFile()
    Dim fso As New FileSystemObject
    Dim txtstr As TextStream
    Set txtstr = fso.OpenTextFile("f:\testingcard\MyReadFile.xml", ForReading, False)
    Dim myfind, myval, mylength
    
     With txtstr
           While Not .AtEndOfStream
                myfind = .ReadLine
                    If InStr(myfind, "<RESULT>") Then
                        mylength = Len(myfind) - 8
                        myval = Right(myfind, mylength)
                        mylength = Len(myval) - 9
                        myval = left(myval, mylength)
                    Debug.Print myval 'or display on form
                    ElseIf InStr(myfind, "<TroutD>") Then
                        mylength = Len(myfind) - 8
                        myval = Right(myfind, mylength)
                        mylength = Len(myval) - 9
                        myval = left(myval, mylength)
                    Debug.Print myval 'or display on form
                    ElseIf InStr(myfind, "<Auth_Code>") Then
                        mylength = Len(myfind) - 11
                        myval = Right(myfind, mylength)
                        mylength = Len(myval) - 12
                        myval = left(myval, mylength)
                    Debug.Print myval 'or display on form
                 ElseIf InStr(myfind, "<Reference>") Then
                    mylength = Len(myfind) - 11
                    myval = Right(myfind, mylength)
                    mylength = Len(myval) - 12
                    myval = left(myval, mylength)
                    Debug.Print myval 'or display on form
                  End If
            Wend
            .close
        End With
        Set txtstr = Nothing
    End Function
    Last edited by gvee; 08-21-07 at 11:13. Reason: Uer request
    Dale Houston, TX

  7. #7
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Dale that is awesome, but I am curious why you are using <XML_FILE> vs just <XML>?
    Ryan
    My Blog

  8. #8
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    xml vs xml_file

    Those are the specs the merchant gave us.
    But out of curiosity - what would be the difference

    I think the "file" designates the routing of the file itself
    Not sure though
    Dale Houston, TX

  9. #9
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    <xml> is a known tag, which signifies it as a xml file. xml_file may just be a xml tag, like <F_name>. So if xml_file is not a known tag, this file will not validate as a xml file.
    Ryan
    My Blog

  10. #10
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    Interestingly the xml_file works - so far - the server we upload to may be looking for this tag only for the type of transaction we are doing.
    Dale Houston, TX

  11. #11
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    I bet the people getting the file wrote a function to interpret the tags as valid, the joys of xml.
    Ryan
    My Blog

  12. #12
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    that is exactly what they did - I tried the <xml> - it failed miserably
    But the xml_file works

    This company just changed their format from txt files to xml (which is text) I bet people are scrambling to build style sheets - I wrote that vb code in about 20 - 30 minutes

    But then again I do not know a style sheet from a hair style - I keep saying that the internet is the Great American Hoax

    Dale Houston, TX

  13. #13
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    I havent gotten my head around how to properly do xsl/xslt yet.
    Ryan
    My Blog

  14. #14
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by rguy84
    I bet the people getting the file wrote a function to interpret the tags as valid, the joys of xml.
    Another reason why I refuse to step into the realms of XML yet.
    I can write the stuff (anybody can) ...doesn't mean I understand how to use the *ahem*
    George
    Home | Blog

  15. #15
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Quote Originally Posted by georgev
    Another reason why I refuse to step into the realms of XML yet.
    I can write the stuff (anybody can) ...doesn't mean I understand how to use the *ahem*
    This goes back to the designer and dev working together conversation...but then again this is a 97 db we are talking about, so I have no idea what format xml was in then...
    Ryan
    My Blog

Posting Permissions

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