Where do I put the code???

  • Thread starter bastraker via AccessMonster.com
  • Start date
B

bastraker via AccessMonster.com

Hello all

OK I know I'm a newbie to this but I'm really lost on how to apporach my
latest brick wall.

I have a table that has three columns of dates, start date, target end date,
and actual end date. I now need to run two sets of code.

1) Look at both start date and actual end date, calculate the number of
working days elapsed

2) Look at both actual end date and target end date, return a predefined
value if we missed the target

I would like it to automatic and instantaneous when values are entered if at
all possible.

Any ideas, insight, and better yet solutions would be greatly appreciated.
D
 
T

TC

(1) Create a form that is based on that table. (Ie. set the
RecordSource property of the form to the name of the table.) Have three
text boxes, one per date. Call them txtStartDate, txtTargetEndDate and
txtActualEndDate. Put the corresponding field name (from the table)
into the ControlSource property of each box. This will give you a form
where you can view, add, edit or delete records in the table concerned.
Remember that the users should /always/ access the tables through
forms, they should never access the tables directly. Make sure this
form works properly before you continue.

(2) Add another textbox called txtDaysElapsed. Put the following entry
into the ControlSource property of that textbox:
=[aaaa]-[bbbb] replacing 'aaaa' with the name of the actual
end date field in the table, and 'bbbb' with the name of the start date
field in the table. Now you will see that the new box dispays the # of
/calender/ days between those two dates.

That should be a start for you. You'll need, eventually, to find some
way of determining which days (between two dates) are "working days".
Today is a holiday (non work day) in Podunk, but not in Bees Knee.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 
B

bastraker via AccessMonster.com

Thanx for the quick reply TC

But what I'm really looking for is an idea as to where to put the code I'm
going to use. Say I'm going to use the following code to update the records
in my table, in what event do you think it would work best. For example I
have the following code in the after update event right now. Problem I'm
having is after I make a change and the field updates my form locks up.

Private Sub Form_AfterUpdate()

If Me.DateCommited >= Me.DateActual Then
Me.OnTime = "Yes"
Else
Me.OnTime = "Missed Target"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top