Results 1 to 2 of 2
  1. #1
    john1951 is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    1

    opening access from vb 6.0 - command line error


    Hello
    I have written a program in VB 6.0 and I want to be able to open my mdb file by clicking on a command button.

    this is my code for opening access

    Code:
    retval = Shell("C:\Program Files\Microsoft Office\OFFICE12\MSACCESS " & filestring & " /nostartup, 1")

    this is the string that is sent by the Shell statement
    C:\Program Files\Microsoft Office\OFFICE12\MSACCESS c:\program files\jhl jobs\newjob\jobs.mdb /nostartup, 1

    I get several error messages (in Hebrew) that indicate an error caused by the string I am passing. Finally Access opens, but doesn't open my database file

    Thank you
    John

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    The problem is most likely with how Windows tokenizes command line input. In short, you need to put quotes around the strings for it to work properly:

    Code:
    retval = Shell("'C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE' '" & filestring & "' /nostartup, 1")
    I'm not sure if this will work (you may need to use double quotes, which is frustrating and confusing to me ) instead.

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

Similar Threads

  1. Replies: 6
    Last Post: 09-14-2012, 11:58 AM
  2. Replies: 1
    Last Post: 01-24-2012, 12:47 AM
  3. query Access databases from the command line
    By xinelo in forum Programming
    Replies: 9
    Last Post: 11-09-2011, 09:08 AM
  4. VBA and command line
    By dsk96m in forum Access
    Replies: 1
    Last Post: 09-04-2011, 08:06 PM
  5. Replies: 2
    Last Post: 10-11-2010, 03:15 AM

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