Link to home
Start Free TrialLog in
Avatar of gracie1972
gracie1972Flag for United States of America

asked on

After Update To Open Form When A Field Is Higher Than Another Field

I am not sure if my syntax is correct so bear with me.

I have a form that is capturing project data by resource. Each resource is allocated a % of his or her time. When projects are assigned, if the % assigned exceeds the % allocated, I would like the following:

A check box (exceptions) to automatically be checked as well as the form (frmExceptions to open) This form is linked to a table that stores the resourceID and ProjectID. I need to be able to track exceptions by Project.

Can this be done easily on an afterupdate script in VB?

If so can you please help me with the code:

Field Names in my SubForm:

ResourceID:
ProjectID
Project% >> This is what a manager would enter a % by project
TotalProject >> Autofilled from Parent Form Table Source. This is what the Project%
should not exceed.
Exception (check box)

This can be tricky.
Each resource may be assigned multiple projects. I need to figure out a way to take into account totals on all Project%, not by Project ID.

Here is my code that I started for the manual process of just checking the exceptions box:

-----------------------------------------------------------------------------------------------------------------
Private Sub Check38_Click()
Dim stDocName As String
Dim stLinkCriteria As String

    stDocName = "frmExceptions"
    stLinkCriteria = "[ResourceID]=" & "'" & Me![ResourceID] & "'"

    DoCmd.OpenForm stDocName, , stLinkCriteria

End Sub
-----------------------------------------------------------------------------------------------------------

This is not working effectively, my form opens, however the ResourceID does not automatically populate.
Avatar of jcrozier21
jcrozier21
Flag of Australia image

I believe I can help you, but I need a little more info.

1) If I have 50% available and I am assigning a % by Project, how can I accurately calculate the totals for all ?

50%? Is this project% or daytoday%? What are you trying to total?

2) If I have  a resource and assign 60% (total determined from Question 1), how can I get my form to trigger an exception (Pop up window to notify we have exceeded the resources available %) this will trigger an exception form to open.

Are you simply after a check to see whether the total % (daytoday or project?) exceeds 100%?

I gather that this application is to track and assign human resources, am I right?
Avatar of gracie1972

ASKER

Yes I am working on a simple access database for tracking resources by project.  It get complicated as my subform tracks each project by project ID>

The 50% available is what is assigned to the Resource in the frmEditResources form.

The subform (frmProjects_subform) lists each project.  I am trying to find a solution that will know that totals in the main form automatically subtract in the subform by project ID.  However I can do this simply, but if I have more than one projectID it only totals on a line by line basis.  

Does this make sense?  I attached my DB for your review to see if I am explaining this correctly.
NACS-Resource-DB---BE---Copy.mdb
ASKER CERTIFIED SOLUTION
Avatar of jcrozier21
jcrozier21
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well not entirely.  I see what you are doing.  I need to wrap my head around what was changed.  The message box and formulas seem to work. I need to change a few things.  The main form needed to have the data from the source table.  This is the entry form.  The calculations you did there, I can actually move to the subform which is what I need.  I will get back to you here shortly, but I think this will work :-)
Thanks!