Results 1 to 14 of 14
  1. #1
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61

    Referencing saved query field name [∆-Dawn] in a procedure?


    Interestingly enough, ∆-time: [TDstamp]-[TD] works in the query-builder making "∆-time" a valid calc'd field header [∆-time] in a saved query. Butcha can't create qry-def in VBA code using it as a field name. Nor can U-reference it in a DLookUp in a procedure. U-can save "∆-time" string value in a table field. U-can even use "∆-Dawn" as a table fieldname [∆-Dawn]. Anyone know how to reference [∆-Dawn] query field name in a procedure using DLookup?

  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,902
    You have a symbol in a field name? Never seen this before. Recommend changing. Really should not use spaces nor punctuation/special characters (underscore only exception) in naming convention.

    I tested that field name with DLookup() in a query and it works. However, DLookup() in VBA has issue. VBA can't render the character.
    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
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    Thanks for the input. If I wanted to change it, I would. What I do want to do is find a work-a-round that may enable VBA to deal with it. Any ideas?

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    You could try using the ASCII character code for the delta symbol in your vba code though I've no idea whether that will work.
    Otherwise I think you will have to change it or not use it in vba.
    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

  5. #5
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    Thanks much. I know of no ASCII code for I could be mistaken. But I cannot find an ALT-code for it. Meanwhile, am enjoying the challenge of seeking work-a-round.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    None. VBA can't read the character. Period.

    Why so insistent this symbol used in field name? Experienced database developers will not use punctuation/symbols in naming convention (with exception of underscore).
    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.

  7. #7
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    I'm not sure 'insistent' is the adjective I would have chosen. Admittedly, I'm curious why VBA won't crunch it. And it order to find out why not, it's actually quite handy to keep trying. Perhaps it's worth mentioning that I don't plan on recommending it to the experienced database developer community as a breakthrough in naming convention alternatives. If you'd like to help figure this out, join in. But U R not gonna convince me not to try simply because it's unconventional. U C, I already know that and I'm trying anyway. That's all there is to it.

  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
    I've just checked the ASCII list and it isn't included though many Greek letters are. I think chr 235 is a small delta but that's no help.
    I think there is an obvious work round but it's the one you seem unwilling to make.

    I wish you luck but suspect it's going to be a waste of your time in the end
    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
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    I'm not doing it for a customer. I'm on a quest for knowledge. If there's a work-a-round, I'll find it. If not, I'm on to something else.
    if SQL can process SELECT tblPrgmrNotes.PgmrNote FROM tblPrgmrNotes WHERE (((tblPrgmrNotes.PgmrNote) Like "*∆*"));
    then I'm a little bit curious as to whether there exists a work-a-round that'll make it happen in VBA.

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    Pretty sure vba doesn't support Unicode - not even with Option Compare Binary. While there are functions like ChrW that I don't know much about, they seem to be intended for converting unicode values to decimal or whatever, but the character source is usually a table or spreadsheet. Thus you likely can process the character, but not by explicitly typing it into the vba editor. The editor will represent it as ? because it's not supported.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    Quote Originally Posted by Micron View Post
    Pretty sure vba doesn't support Unicode - not even with Option Compare Binary. While there are functions like ChrW that I don't know much about, they seem to be intended for converting unicode values to decimal or whatever, but the character source is usually a table or spreadsheet. Thus you likely can process the character, but not by explicitly typing it into the vba editor. The editor will represent it as ? because it's not supported.
    Thx 4 the input. I tend 2 agree and that's the direction I'm headed in. gonna keep pluggin' away

  12. #12
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Actually VBA can handle unicode at least in the following context
    I work with importing JSON files into Access & to do so I need to detect the file's tristate level - the most common is true (unicode) but some are false (ascii) or mixed(!)

    JSON files are of course just text files and you can edit the tristate level of any text file in Notepad, then click Save As and changing the encoding setting Unicode being one option.

    And I just looked at a JSON file I made with deliberately difficult characters to see if Access could import them to a table - it can!
    And for what its worth look at the symbol I highlighted in the screenshot

    Click image for larger version. 

Name:	Capture.PNG 
Views:	14 
Size:	140.0 KB 
ID:	33976

    If anyone cares, you can look at the attached JSON file renamed as txt for uploading
    Attached Files Attached Files
    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

  13. #13
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    Yes, and you can paste that symbol directly in to a table, and as the OP stated, use it in a query as well. My point was that you can't use it in vba construct.
    Thus you likely can process the character, but not by explicitly typing it into the vba editor

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

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

Similar Threads

  1. Replies: 9
    Last Post: 01-13-2015, 07:30 AM
  2. Replies: 9
    Last Post: 12-08-2013, 07:04 PM
  3. Referencing a Report Field with VBA
    By Lorlai in forum Programming
    Replies: 13
    Last Post: 03-26-2013, 09:53 AM
  4. Referencing Field Names
    By andy-29 in forum Access
    Replies: 6
    Last Post: 11-20-2012, 03:27 PM
  5. Referencing a query field
    By rcrobman in forum Queries
    Replies: 5
    Last Post: 04-29-2011, 04:06 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