Results 1 to 4 of 4
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,185

    Bad File Name Or Number

    Hi Guys' help!!!



    I ma having trouble trying to work this out when it should be simple !!!!, i have similar working ok on another db, can't get this one working though

    on my PC my Google Chrome path is in Program Files (x86)

    ON another PC Google Chrome isn't in the same path so when i change Front end DB to the other machine, it won't work unless the correct path is located, this is what i have but debugging on bold line

    Code:
    Dim stAppName As String, myURL As String, OpenChrome As String, myApp As StringDim stPathName As String
    
    
    OpenChrome = """C:\Program Files\Google\Chrome\Application\chrome.exe"""
    stFilePath = "https://onedrive.etc etc..........."
    
    
    If Len(Dir(OpenChrome, vbDirectory)) = 0 Then
    OpenChrome = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"""
    End If
     
    Shell (OpenChrome & stFilePath)

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Ranman256 has posted code here to open a file with the default app for that file type.?
    Your code does not even compile?

    You really need to start walking through your code to identify the errors.

    My chrome is in the first link and this works.

    Code:
    Public Sub OpenChrome()
    
    Dim stAppName As String, myURL As String, OpenChrome As String, myApp As String
    Dim strFilePath As String
    
    
    OpenChrome = "C:\Program Files\Google\Chrome\Application\chrome.exe "
    strFilePath = "www.bbc.co.uk"
    
    
    If Len(Dir(OpenChrome, vbDirectory)) = 0 Then
    OpenChrome = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe "
    End If
     
    Shell (OpenChrome & strFilePath)
    
    End Sub
    I have no idea what you were thinking with all those double quotes for a simple string?
    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

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    My Chrome is in the second link and the posted code in #2 works for me (Ms Access O365 Ver: 2105 click to run)

  4. #4
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,185
    Thank you guys

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

Similar Threads

  1. Replies: 1
    Last Post: 06-07-2020, 07:59 PM
  2. Replies: 10
    Last Post: 11-07-2017, 06:53 PM
  3. bad file name or number error
    By lolibooki in forum Access
    Replies: 4
    Last Post: 09-25-2013, 12:46 AM
  4. auto fill name based on file number
    By mark_w in forum Forms
    Replies: 13
    Last Post: 08-03-2012, 04:59 AM
  5. count number of file names within a folder containing
    By dumbledown in forum Programming
    Replies: 2
    Last Post: 04-24-2012, 02:55 AM

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