+ Reply to Thread
Results 1 to 7 of 7

Converting excel to xml recordset

  1. #1
    Registered User
    Join Date
    03-20-2009
    Location
    Lithuania
    MS-Off Ver
    Excel 2013
    Posts
    99

    Converting excel to xml recordset

    Hi,

    I use below code, to convert excel to recordset and save it as XML file:
    Please Login or Register  to view this content.
    This is unfinished code, so there some unnecessary variables, so just ignore them.
    The issue which I encounter is that several column names have character ".", for instance, "Name.", "Employee No.", etc. Due to some reason, SQL code "SELECT * FROM [Duomenys$a:ai]" converts dots in column names to hash symbol, and then recordset contains field names "Name#", "Employee No#".
    I tried many different approaches: tried to use different connection string, tried to use specific SQL code "SELECT [Name.] FROM [Duomenys$a:ai]", but nothing worked. Specific SQL code works only when I use hash symbol.
    For instance, this works:
    Please Login or Register  to view this content.
    This doesn't work:
    Please Login or Register  to view this content.
    Trying to change field name in the recordset isn't possible. If I read material for working with recordsets correctly, then it's not possible to change field names after recordset is opened, but I don't know how to change field names before this action.

    I'm very little familiar with working with ADO recordsets via Excel VBA, this is new for me. SO I would appreciate the help to find a solution, how to avoid Excel converting dot character "." to hash character "#" in the columns/fields names.
    Last edited by walduxas; 03-03-2021 at 10:52 AM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Converting excel to xml recordset

    A dot is not valid in a field name in Access, so those providers won't allow it.
    Rory

  3. #3
    Registered User
    Join Date
    03-20-2009
    Location
    Lithuania
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Converting excel to xml recordset

    I checked other characters, for instance ",", "*", "~". Those characters were not replaced by hash "#". Am I correct, that only dot character is not allowed?.
    Also, according to this material
    HTML Code: 
    , dot is not allowed as an initial character, but dot should be allowed for remaining characters. Or am I misunderstanding the material?

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Converting excel to xml recordset

    No, I think you're misunderstanding what I said. In Microsoft Access / Jet, you cannot use a dot in a field name. Since the providers you are using are for that, they do not accept dots in field names, and convert them to #. Depending on why you need to keep the dots, the only thing I can suggest is that you perhaps try a different provider, if you have one available.

  5. #5
    Registered User
    Join Date
    03-20-2009
    Location
    Lithuania
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Converting excel to xml recordset

    Thanks. Are there any other characters, which are not allowed in field names?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Converting excel to xml recordset


  7. #7
    Registered User
    Join Date
    03-20-2009
    Location
    Lithuania
    MS-Off Ver
    Excel 2013
    Posts
    99

    Re: Converting excel to xml recordset

    Thanks, will try to work around by replacing disallowed characters with null string

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Open another recordset within current recordset vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2015, 04:32 AM
  2. Oracle recordset to Excel
    By pm65151 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-15-2008, 04:15 PM
  3. import excel to recordset in ASP
    By Le9569 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2006, 05:25 PM
  4. [SOLVED] import excel to recordset in ASP
    By Le9569 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2006, 05:20 PM
  5. import excel to recordset in ASP
    By Le9569 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2006, 05:15 PM
  6. [SOLVED] Vba recordset for Excel programming
    By marthasanchez in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2006, 02:00 AM
  7. [SOLVED] Recordset's RowID as part of Recordset
    By Trip in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2005, 06:55 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1