Results 1 to 5 of 5

Thread: VB code help

  1. #1
    Join Date
    Jan 2003
    Location
    Guelph, Canada
    Posts
    39

    Unanswered: VB code help

    Each field is to hold the date and time that three pieces of code are run.
    The code for first field will be run each day. The code for the second and third fields may be run the same day, the following day before the first field code is run, or skipped altogether.

    I have code to get the date into the first field:

    rs.Open "LogThree", cnn, , adLockOptimistic
    rs.AddNew
    rs![PrintList] = Now()
    rs.Update

    What I'd like help with is the code for the other two fields.
    If by the next day, the first field already has its date/time entered, then I'd like the second and third fields (from the previous day) to be left blank. So, by example:


    5/15/03 9:30:28 AM 5/15/03 9:50:39 AM 5/15/03 10:05:03 AM
    5/16/03 9:32:08 AM
    5/17/03 9:35:14 AM 5/17/03 9:55:32 AM 5/17/03 10:15:09 AM

    Help with the code for this would be much appreciated!

    Eric

  2. #2
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    let me just say yuk!!!

    now thats out of the way i think i can get it to work your way but it would be much easiler if the log file went

    PrintList, 5/15/03 9:30:28 AM
    2, 5/15/03 9:50:39 AM
    3, 5/15/03 10:05:03 AM
    PrintList, 5/16/03 9:32:08 AM
    PrintList, 5/17/03 9:35:14 AM
    2, 5/17/03 9:55:32 AM
    3, 5/17/03 10:15:09 AM

    you could then use a cross tab query to do the formating

    will that be okay, or do you really want the hard method?
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  3. #3
    Join Date
    Jan 2003
    Location
    Guelph, Canada
    Posts
    39
    Hi m.timoney,

    Thanks for your reply!
    I don't think you quite caught the drift of what I'm after.
    Let me explain better.

    My Table has three fields. Each field is to hold its own date.
    the layout isn't important. The fields can be next to each other or one on top of each other.

    Most days each field will be populated when each appropriate task has been completed. The first task is completed around 11:30 a.m.
    Second around 2:30 p.m. and the third shortly after.

    If the 2nd and 3rd tasks are not completed the same day as task one, then there is still time the next day to fit them in as long as Task1 hasn't been run yet.
    So the second day could look like: (notice the dates)

    5/15/03 9:30:28 AM 5/16/03 10:30:56 AM 5/16/03 10:35:42 AM

    but if tasks 2 and 3 don't make the deadline then I'd like the record to look like:


    5/15/03 9:30:28 AM (blank) (blank)
    5/16/03 9:30:45 AM 5/16/03 2:30:12 PM 5/16/03 2:40:14 PM
    etc.

    I hope this makes more sense. I need the VB code to update the 2nd and 3rd date/times.

    Thanks! Eric

  4. #4
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    oh i got what you after, but the way your doing it is not the best way of doing it the better way is to have a table with 2 fields 1 holds the process ID the other holds the date/time

    this is the way data is ment to be put in access not to metion that this method is a hell of a lot easier.

    but like i said if you really what to do it your way i can do it , i just would rather not
    the basics for your method are
    rs.Open "LogThree", cnn, , adLockOptimistic
    rs.movelast
    rs.edit
    rs!<fieldname>= Now()
    rs.Update
    Last edited by m.timoney; 05-21-03 at 07:14.
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  5. #5
    Join Date
    Jan 2003
    Location
    Guelph, Canada
    Posts
    39
    Thanks very much m, I'll give it a shot.

    Eric

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •