Results 1 to 4 of 4

Thread: If error number is 3050 then ignore?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    If error number is 3050 then ignore?

    Hi guys on my vb project which connects to my microsoft access database I keep getting an error : 3050: Could not lock file.

    Is there away to either ignore the error throughout the entire project or does anyone know how to fix the error?

    Thanks,
    Jamie.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: If error number is 3050 then ignore?

    How are you connecting to the database? Do you really need to lock the file?
    Normally one would not be locking the file so other people can use it at the same time.
    If anyone else is using it then you can not lock it.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    Re: If error number is 3050 then ignore?

    Set WS = DBEngine.Workspaces(0)
    dbfile = Form1.Text3.Text
    pwdstring = "passs"
    Set db = DBEngine.OpenDatabase(dbfile, False, False, ";PWD=" & pwdstring)


    Set rs = db.OpenRecordset("SELECT * FROM agents")

    that's how i am connecting, there are about 10 people that use the database, so not sure why it trys to lock.

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: If error number is 3050 then ignore?

    Been a long time since I have did anythign with DAO. You really should be using ADO code instead. Even when I did use DAO I rarely used workspaces. Looks like you are not using the workspace there and it looks like the database should be opening in shared mode.

    I would recommend using ADO Code instead but if you want to use the outdated DAO methods perhaps this may help http://msdn.microsoft.com/en-us/libr.../ff835343.aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width