Results 1 to 3 of 3
  1. #1
    TotalNovice is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    7

    Best way to retrieve a value from within a macro?

    Hi



    I believe my question is so rudimentary that I cannot find an answer online, even after about an hour of searching. I'm writing a macro and need an IF statement to control setting a TempVar. For the life of me, I can't figure out how to get a value into this stupid thing!

    Here's the basic idea:
    I've split my database. There is a table for filters on the backend, for those filters everyone needs to use. I've also made a local table for filters that each user can create. To differentiate between the two, I added a binary field named "Scope" to each. BE filters are 0, FE are 1. I need to pull that scope field to determine which table should be used.

    The [Screen].[ActiveControl] is passing the ID of the filter specs. Dlookup on the query used to populate the list returns "The object doesn't contain the Automation object 'qryFilters.'

    What am I missing? Thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,820
    Post the DLookup() expression.
    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.

  3. #3
    TotalNovice is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    7
    Hi again June

    The lookup was =DLOOKUP("Scope","qryFilters","ID = " & [Screen].[ActiveControl])

    I managed to figure out a solution though, which was to directly reference the listbox and return the 2nd column, which contained me value.

    In case this gets picked up by the interweb-spiders someday, my IF statement looked like
    Code:
    [Forms]![frmTaskList]![cboFilterFavorites].[Column](2)=0

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

Similar Threads

  1. using SQL in VBA to retrieve data
    By sovereign in forum Access
    Replies: 8
    Last Post: 08-25-2015, 10:17 AM
  2. Retrieve entered value
    By zipaway in forum Programming
    Replies: 3
    Last Post: 06-10-2014, 08:53 AM
  3. retrieve Column Name
    By drunkenneo in forum Queries
    Replies: 6
    Last Post: 10-31-2013, 11:50 PM
  4. retrieve value from another form
    By joshynaresh in forum Forms
    Replies: 4
    Last Post: 10-27-2013, 03:39 AM
  5. how to retrieve the column name
    By rlaplume in forum Access
    Replies: 3
    Last Post: 04-09-2013, 12:41 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