Results 1 to 4 of 4
  1. #1
    Datech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    40

    Confusion with Data Macros and SetField

    I have a Table called Resource Allocation that pairs an employee name with a job, and stores how much they work as well as a value called headcount. I'm trying to automate the value of the Headcount field (text) based on the Percent Utilization field (number) as well as some other information. My goal is to automate it in a large macro with some If statements.

    I can't even get my first If statement to work properly though. Here's what I'm trying:
    A Data Macro that triggers After Update - this way if the Percent Utilization is updated manually in the table or through the input form it will automatically recalculate the Headcount field for that line (and eventually others, but I'll ask for help on that later)
    If [Percent Utilization]=100 Then -therefore, if 100%, then do the following
    Edit Record
    Alias -left blank so it edits the currently selected record
    Set Field


    Name Resource Allocation.Headcount - the name of the field to edit
    Value = "True" - enters a text value of True
    End EditRecord
    End If


    I can't get it to work at all. If I edit anything in the Percent Utilization field nothing changes, and Refresh doesn't do anything either. I also tried this as a Named Macro, then called it in another Macro so that I knew it would run. Still no dice.

    I have very little macro experience, but I've read most of the chapters on Macros in Access 2010: The Missing Manual. Let me know what I'm doing wrong, and thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    And that's why I don't use macros, only VBA. VBA easier to debug. If you want to provide db, will look at. First example of a data macro I've encountered.
    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
    Datech is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    40
    A week's worth of Access experience sure changes some perspectives. Hopefully we won't have to use data macros at all, since we won't be using a web database anymore.

    To confirm without posting another thread: If I have a shared database on a network fileshare, with the back end being on the server and individuals having their own copy of the front end, I can use VBA in my database without a problem, right? I know for web databases you're only allowed to use macros. Just looking for confirmation, thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Quote Originally Posted by Datech View Post
    If I have a shared database on a network fileshare, with the back end being on the server and individuals having their own copy of the front end, I can use VBA in my database without a problem, right? I know for web databases you're only allowed to use macros. Just looking for confirmation, thanks!
    Consider it confirmed.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Block IF End IF Confusion
    By Phred in forum Programming
    Replies: 11
    Last Post: 03-10-2012, 02:18 PM
  2. VB and SQL confusion
    By Wayne311 in forum Programming
    Replies: 29
    Last Post: 01-31-2011, 10:27 PM
  3. Events Confusion?
    By homerj56 in forum Programming
    Replies: 5
    Last Post: 10-27-2010, 01:45 PM
  4. Combo box lookup confusion
    By redpenner in forum Forms
    Replies: 5
    Last Post: 08-19-2010, 08:45 PM
  5. Confusion
    By colenzo in forum Access
    Replies: 4
    Last Post: 07-21-2009, 06:38 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