Results 1 to 4 of 4
  1. #1
    Matze0710 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    5

    Use Varibales in a query with VBA in Access 2010

    Hello guys,



    I need to use a varibale in a query, because a person needs to lookin into a screen and after that the person shoudl see his/her query depending on his user account.

    Where do I need to store the variable and how can I use the variable in a query?

    Best regards

    Matthias

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    How about stepping back and describing in plain English WHAT you are trying to accomplish?
    No jargon -and don't assume we can guess what you're talking about. Details and an example would help readers to put your issue into context.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    If you mean a VBA variable, you can't use it directly. Create a public function that returns the value of the variable, and call that from the query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Users should not even see much less work with tables and queries. Apply filter criteria to form or report.

    I store user's login ID on a form that never closes (such as MainMenu) then it is always available for reference.

    This is a split database?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 01-07-2016, 12:49 PM
  2. Query problem in Access 2010
    By Lynn Cohen in forum Access
    Replies: 2
    Last Post: 09-17-2014, 11:41 AM
  3. Replies: 6
    Last Post: 07-07-2014, 09:13 AM
  4. Replies: 0
    Last Post: 07-31-2012, 12:25 PM
  5. Accessing main form varibales in sub form
    By accesscoder in forum Forms
    Replies: 7
    Last Post: 10-17-2010, 01:21 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