Results 1 to 13 of 13
  1. #1
    maroberge is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    5

    Export query to HTML returns numbers rather than names for lookup field

    My query calls up two tables ("T_Names", "T_Scores"). In "T_Scores", field "Editor" is filled using lookup values from "T_Names"; there is thus a "1 to ∞" going from "T_Names.No" to "T_Scores.Editor" when I create the query.



    These fields are added in the query page’s lower part, where I list "Editor" and "TitleOriginal", both from "T_Scores". In SQL view, the query reads:
    Code:
    SELECT T_SCORES.Editor, T_SCORES.TitleOriginal
    FROM T_NAMES INNER JOIN T_SCORES ON T_NAMES.N° = T_SCORES.Editor
    ORDER BY T_SCORES.Editor;
    The query executes correctly, but when I export it to HTML and display it my browser, column "Editor" shows record numbers rather than the names of the editors. I stumble on this problem in many exported queries and have great difficulty pinpointing the source of the problem. Thanks in advance for any help.
    query,

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Are you using lookup fields in your table?

  3. #3
    maroberge is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    5
    Yes, as I mentioned in my post, the names of editors come from a table, and I choose the names from a dropdown list.

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Easy answer is don't use lookup fields in tables.
    http://access.mvps.org/access/lookupfields.htm

    I guess Access isn't passing along the underlying connection it makes between your lookup field and the hidden system table where the actual values are kept. The reason I'm guessing is because I, like so many others, do not use lookup fields in tables. You could try using Editor.Value in the query and see if that helps, but I've only ever seen that as a solution when a query refers to a joined field and that field is a lookup field.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    maroberge is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    5
    I had read the page at the link you quote, as well as other pages that do not see anything wrong with lookup tables. In my case, they are quite essential: I have a list of some 2,000 names from which I need to choose in several tables. With regard to your suggestion of using "Editor.Value", I must say that this is what I would do if I were dealing with multivalued fields, which is not the case here. It is simply a lookup table, and no *.Value entry is available.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    The lookup fields merely hide what you would do manually. In doing so, they have confused you as they confuse many others who use them? I have lost count of how many times this question gets asked. Just wish I had a pound for every time it has been asked.

    So if you do not want to get rid of the lookup fields, then bring in the tables/queries that hold the lookup data and use those fields instead.

    great difficulty pinpointing the source of the problem
    lookup fields, pure and simple.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    I'm afraid your comment about lookup fields in tables being essential is lost on me. The proper method is to have a lookup table, not a lookup field. Sure, you will find many pages that write positively about them; probably because they're catering to an audience that hasn't the interest or ability to do things properly.

    Perhaps your post title threw me off, because an index number is what I'd expect to get instead of a value where mv fields are involved. So you are correct in relating .Value to being a mv field issue. I guess I wasn't of much help.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Like everyone else here, I would strongly advise against using lookup fields in tables.
    I suggest you read my article on this topic to understand the reasons for your current problem: http://www.mendipdatasystems.co.uk/t...lds/4594445135

    You also mentioned that you use multivalued fields. These are also a bad idea for similar reasons: See http://www.mendipdatasystems.co.uk/m...lds/4594468763

    There are better alternatives to both of these features
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  9. #9
    maroberge is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    5
    Thank you for the many replies. I guess that I should have called what I am using a "Lookup Table", created by using the Lookup Wizard. I have read (and will reread) Colin's pages warning against the two "easy" methods offered by Access and I also tried exporting my query with formatting. The names I expected indeed appeared in the resulting page, but this caused Microsoft to add even more "bloat" than what it does when choosing to export without format. For instance, a table line will look as follows because Access is adding whatever HTML code is needed to reproduce the look of the original query, which is absolutely irrelevant when you need to insert such code into a web page:
    Code:
    <TR VALIGN=TOP><TD BORDERCOLOR=#d0d7e5 ><FONT style=FONT-SIZE:11pt FACE="Calibri" COLOR=#000000>Creation, The</FONT></TD>
    <TD BORDERCOLOR=#d0d7e5 ><FONT style=FONT-SIZE:11pt FACE="Calibri" COLOR=#000000>Haydn, Joseph</FONT></TD>
    
    
    </TR>
    All this code has to be deleted using a custom macro before inserting the table code into an HTML page. When dealing with an unformatted page, this is rather quick, but awfully long in the case of a formatted page.

    The fact remains that I have used lookup tables with success many times, but in the case described in my original post, I am only running in circles. Is there a full-scale tutorial for beginners in the art of avoiding lookup tables and multivalued fields and thus work like the pros?

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Is there a full-scale tutorial for beginners in the art of avoiding lookup tables and multivalued fields and thus work like the pros?
    General MS Access:

    MS Access video series by Steve Bishop.

    Several articles in the Database Planning and Design link in my signature.
    Colin's materials are great.
    My guess is you'll have to change your table structure and re-design without using field level lookup and/or multivalued fields.

    Here is one veteran programmer's view to lookups/multivalued fields.

  11. #11
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    You are getting confused.
    Lookup tables are absolutely fine
    However lookup fields in tables are what you need to avoid - that's what my article explains.
    And, if you didn't do so before, also read the referenced link - the evils of lookup fields in tables: http://access.mvps.org/Access/lookupfields.htm
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  12. #12
    maroberge is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2021
    Posts
    5
    Thanks to all for your comments. I have experimented a lot with the export possibilities offered by Access and concluded that my best bet, short of restructuring much of my database, is to export to Excel (formatted). This gives the expected result, as mentioned by Colin in his article Issues with Table Level Lookup Fields. The amount of editing with macros before and after pasting into Dreamweaver is minimal and answers my needs, at least for now. I have started watching Steve Bishop's videos and will surely benefit from them.

  13. #13
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    I would have thought no restructuring is required?
    You just remove the lookup fields in the table. That reveals the true value in the field. Then you use a query to bring the data together, including that in your lookup tables.

    No restructuring as I understand it.?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change Query Field Names on Export
    By neuk in forum Queries
    Replies: 2
    Last Post: 03-18-2020, 01:05 PM
  2. Replies: 21
    Last Post: 09-02-2018, 11:49 AM
  3. Replies: 7
    Last Post: 03-21-2018, 04:58 AM
  4. Lookup returns unwanted HTML tags
    By George in forum Access
    Replies: 4
    Last Post: 07-22-2015, 07:17 PM
  5. Replies: 1
    Last Post: 09-11-2012, 10:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums