Results 1 to 6 of 6
  1. #1
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20

    Need a 'smart' field

    Hi guys,

    Here's what I'm trying to do...

    I have a table of employees with their HIRING_DATE stored in a field in DATE format. In the same table I have another field which is called TRIAL_PERIOD which is in a NUMBER format (possible values 0,3,6,12 - 3,6,12 months of trial period respectivelly, and 0 if the trial period is over).

    Where it all gets messy, is that I need to display the schedule for the evaluations (as a DATE):
    FIRST_EVALUATION, SECOND_EVALUATION and THIRD_EVALUATION

    The problem is that those dates are calculated differently for the different trial periods:
    e.g. for a 3 months trial period the evaluations are done as follows:
    1st eval - after 1 month
    2nd eval - not required
    3rd eval - after 2 months

    for a 6 months trial the evals are:
    1st eval - after 2 months
    2nd eval - optional
    3rd eval - after 4 months

    and for a 12 months trial:
    1st eval - after 2 months


    2nd eval - after 6 months
    3rd eval - after 10 months


    What do you recon to be the best way to implement this?


    Thanx

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can't have a calculated field, so you're going to need to set those values yourself. I'd probably have a function in the form where the user inputs the hire date and trial period. Use a Select/Case to evaluate the trial period, and within each case set the 3 dates appropriately.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664

    Here's what I'm trying to do...

    I have a table of employees with their HIRING_DATE stored in a field in DATE format. In the same table I have another field which is called TRIAL_PERIOD which is in a NUMBER format (possible values 0,3,6,12 - 3,6,12 months of trial period respectivelly, and 0 if the trial period is over).

    Where it all gets messy, is that I need to display the schedule for the evaluations (as a DATE):
    FIRST_EVALUATION, SECOND_EVALUATION and THIRD_EVALUATION
    One way is to use a UDF in a query to calculate the dates "on-the-fly". (See attached A2K3 mdb; it could use more validation code).

    If you want to store the dates so you can nudge the dates a little, put code in the after-update event of the two fields "HIRING_DATE" and "TRIAL_PERIOD", checking that both controls have valid data and if the data is good, calc the eval dates

    or

    use code in the form before-update event to validate the two controls, then use the UDF to calculate the 3 dates, then save the record. If you want to add an optional date or change the eval date a few days, you can edit the controls.

    just my $0.02 .....

  4. #4
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20
    That's exactly the kind of thing I needed. There's absolutely no problem in calculating the data on the fly as I won't be needing to save it somewhere. If can be generated every time the form is opened. I'll play around a little with your code and keep you posted.
    Thx

  5. #5
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20
    That's the ticket Works great! Thank you for your help

  6. #6
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You're welcome.

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

Similar Threads

  1. Replies: 4
    Last Post: 02-08-2011, 08:43 AM
  2. Replies: 9
    Last Post: 12-15-2010, 01:44 PM
  3. Replies: 1
    Last Post: 11-13-2010, 12:57 PM
  4. Replies: 3
    Last Post: 11-05-2010, 03:10 PM
  5. Replies: 1
    Last Post: 02-26-2009, 11:31 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