Results 1 to 6 of 6
  1. #1
    jsbotts is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Aug 2011
    Location
    Hobbs, NM
    Posts
    14

    Chr(ascii_number) function not working in Access 2010.

    The following code worked in Access 2007 but in recent install of 2010 there is a compile error which highlights the Chr(34) function.

    Dim path As String
    Dim dir As String
    Dim wdpath As String
    dir = MFunctions.ReadFile("CL_FileDir.txt")


    path = "C:\" & dir & "\" & fn & ".docx"

    wdpath = "WinWord.exe" & " " & Chr(34) & path & Chr(34)
    Shell wdpath, vbNormalFocus

    I have not been able to find a solution.

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    I had this problem.
    You need a LF and CR.

    I was told to use vbCRLF and it worked great.

    It is a Chr(13) and a Chr(10).

    Found under Miscellaneous Constants in VBA help.

    Dale

  3. #3
    jsbotts is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Aug 2011
    Location
    Hobbs, NM
    Posts
    14

    Used quotation marks

    Quote Originally Posted by rzw0wr View Post
    I had this problem.
    You need a LF and CR.

    I was told to use vbCRLF and it worked great.

    It is a Chr(13) and a Chr(10).

    Found under Miscellaneous Constants in VBA help.

    Dale
    Instead of Chr(34) I used quotation marks and no longer get the compile error.

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Glad you got it working.

    Dale

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    FYI, Chr(34) works fine in 2010, just tested. You might check references, as that can cause this type of issue:

    Access Reference Problems

    vbCrLf (or Chr(13) & Chr(10)) would do something completely different, so not appropriate here.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Thanks again Paul.
    You are doing a great job of keeping things straight.
    I did not read the post correctly or completely.

    Dale

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

Similar Threads

  1. MAX function is not working in Access 2007 DB
    By falen_boyz in forum Access
    Replies: 5
    Last Post: 12-19-2012, 10:32 AM
  2. Need Help With DLookUp Function in Access 2010
    By fmartz in forum Programming
    Replies: 2
    Last Post: 09-05-2012, 09:34 AM
  3. Access 2010 function
    By abm1961 in forum Access
    Replies: 5
    Last Post: 07-21-2011, 12:15 PM
  4. Replies: 4
    Last Post: 06-15-2011, 03:55 AM
  5. Working with OLE excel charts in Access 2010
    By snoopy2003 in forum Programming
    Replies: 1
    Last Post: 02-23-2011, 12:46 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