Results 1 to 5 of 5
  1. #1
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    55

    How to use slash (/) in query column name

    Hi,
    I'm using Access 2010 on a Win 11 pro box.
    Was wondering how to use the slash (/) as part of a column name in a query.

    I have a DB containing all books I've read or possess, that are to be read. The main table has a Yes/No field labeled Non-Fiction.
    I've built a query that indicates all the books which have been read so far. I wanted to add the Non-Fiction field to the query using the following: F/NF:IIF([Non-Fiction]=False, "F","NF"). When I run this query, the column header appears just as expected, but all the data in the column shows as a blue box with a white hyphen in it.

    If I change the criteria to: F or NF:IIF([Non-Fiction]=False, "F","NF"), the data appears correctly. If I change the criteria to: F\NF:IIF([Non-Fiction]=False, "F","NF"), again the data appears correctly and the same if I substitute a hyphen for the slash (/).

    Is if possible to have the header appear with the forward slash? Is there any workaround?



    Thanks,
    Vic

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Advise not to use spaces nor punctuation/special characters in naming convention.

    Odd thing is, I have no problem with query alias fieldname using / character.

    Additionally, / aligns data right and with \ aligns left same as is normal for text.

    The =False is not necessary. Could use: IIf([Non-Fiction], "NF", "F")

    Could do this calc in textbox on report. Label caption can be F/NF.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Works fine for me as well.
    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

  4. #4
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    55
    Thanks for your replies. But the question I have is: the data you display under that heading a yes/no type?

  5. #5
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    55
    Forgive me folks. I went back and was going to take a screen shot of what I was talking about. Low and behold, it now works!! Don't have a clue why it didn't work the first time I was working with it.
    Again, thanks for your indulgence.
    Vic

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

Similar Threads

  1. Insert into when field has a slash "/"
    By carmenv323 in forum Queries
    Replies: 3
    Last Post: 10-09-2023, 11:54 AM
  2. Can not scan barcodes that contain slash
    By goldenberg1957 in forum Access
    Replies: 4
    Last Post: 03-26-2021, 08:20 AM
  3. Replies: 3
    Last Post: 05-14-2020, 04:11 PM
  4. Forward slash "/" showing up in count total
    By UAVPilotMRG in forum Reports
    Replies: 4
    Last Post: 09-27-2019, 08:39 PM
  5. Replies: 4
    Last Post: 12-29-2015, 03:25 PM

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