Results 1 to 4 of 4
  1. #1
    sarnata is offline Novice
    Windows 7 Access 2003
    Join Date
    Sep 2010
    Posts
    4

    CurrentDb.QueryDefs

    I have a quick question... I am modifying an Access Database used in a multi-user environment. In the code, the original programmer modifies CurrentDb.QueryDefs("somequery") to add a where condition to filter the recordset. The updated query then supplies records to a form.



    My question is this. If the CurrentDb.QueryDef is modified for one user does the change affect all users? Is the scope of change for the one user or all users?

    If the change affects all users, you can see how this would be a problem if one user filtered on a value, the filter would then be applied to all users.

    Any thoughts?

    Thanks,
    Eric

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    if the db is split, which it should be, all users should not see the filters. The only thing that should be in the BE are the tables....the rest of objects in the BE. queries are not source data.

    it depends how you set it up though. another thing to note is that currentdb() can randomly cause weird errors when used in code if it's not SET to a database variable. I've had it happen when using currentdb.execute.

  3. #3
    sarnata is offline Novice
    Windows 7 Access 2003
    Join Date
    Sep 2010
    Posts
    4
    Thanks... And to clarify your last statement... I should do something like this

    set db = CurrentDb()
    db.QueryDefs("somequery")...

    correct? Thanks.

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by sarnata View Post
    Thanks... And to clarify your last statement... I should do something like this

    set db = CurrentDb()
    db.QueryDefs("somequery")...

    correct? Thanks.
    yes. always make sure too, to indicate which library that database (and recordsets) comming from (e.g. - ADO or DAO)
    Code:
    dim db as DAO.database
    set db=current()

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

Similar Threads

  1. Update sql using currentdb.execute
    By laavista in forum Access
    Replies: 13
    Last Post: 08-15-2011, 03:51 PM
  2. Replies: 5
    Last Post: 06-10-2010, 05:46 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