Results 1 to 5 of 5
  1. #1
    diods87 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    3

    Access 2010 Macro design query - please help!


    Hi All.
    I am having a problem with a design of my Macro.
    I am trying to use "If" statement which should say the following: if the data in the table is "No" (this table include two columns named "Processed" and "date". There is only one row in that table that says "No") then run query q_xxx_xxx and come up with a message box after, otherwise (else) come up with the message box. I will paste the screen shot of that below:

    Unfortunately what I've done below does not work. I get the error fault, that I also pasted below. Please help?
    Thank you!
    Click image for larger version. 

Name:	Capture3.JPG 
Views:	14 
Size:	28.4 KB 
ID:	14217
    Martin



    Click image for larger version. 

Name:	Capture.JPG 
Views:	18 
Size:	27.3 KB 
ID:	14215Click image for larger version. 

Name:	Capture2.JPG 
Views:	18 
Size:	36.0 KB 
ID:	14216
    Last edited by diods87; 10-29-2013 at 08:04 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Cannot reference table or query fields directly (except maybe with Data macro) no matter how many (or few) records there are. Must use domain aggregate functions to pull data from table or query. Access Help has guidance on the functions (DLookup, DSum, DAvg, etc).
    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
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    use the entire name sequence: Form!FormName.ControlName="No"

    and one presumes that by "No" you do literally mean that word......if it is a yes/no field type then you use = 0

    hope this helps

  4. #4
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Are you wanting to run that query if there exist ANY records that say NO, or if there is a particular record that says no? At that particular point, the Macro isn't looking at any particular record, so that test is meaningless.

    Maybe you should consider using DCount instead, or running a VBA routine that will check each record and execute the query for each one that is No.

  5. #5
    diods87 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    3
    Thank you for all your replies. In the table there is only one recond that says "NO" (text).
    I used DLookup function as suggested and that worked!
    Many thanks.
    Martin

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

Similar Threads

  1. Replies: 8
    Last Post: 12-03-2013, 08:40 AM
  2. Replies: 4
    Last Post: 11-21-2013, 12:33 PM
  3. Data Macro in Access 2010
    By rkalapura in forum Programming
    Replies: 1
    Last Post: 07-06-2012, 08:38 AM
  4. Access 2010 Macro Help
    By RayMilhon in forum Access
    Replies: 3
    Last Post: 09-30-2011, 12:03 PM
  5. Access 2010 Macro
    By RayMilhon in forum Access
    Replies: 3
    Last Post: 09-28-2011, 11:37 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