Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    83

    Unanswered: The "Blank" Record

    I've got an =Now() set in my table as the default value, this means that the very last field in any query, form, or report always has that one piece of data inside it...so for example if I only had 1 record in the whole DB a report would print off 2.

    The reason for doing it this was was to capture the date when the user created the record. Is there a better way to accomplish something like this?

  2. #2
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231

    Re: The "Blank" Record

    I don't completely understand...can't you just leave off that piece of info in your query, form or report?

    Originally posted by High_D
    I've got an =Now() set in my table as the default value, this means that the very last field in any query, form, or report always has that one piece of data inside it...so for example if I only had 1 record in the whole DB a report would print off 2.

    The reason for doing it this was was to capture the date when the user created the record. Is there a better way to accomplish something like this?

  3. #3
    Join Date
    Mar 2004
    Posts
    83
    What it's supposed to be doing is placing a date/time stamp on the record. I placed it as a default value b/c it should never be blank, and should be populated only when the record is created.

  4. #4
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    I'm not the best at this, but see if this makes sense.
    Table - tblWhatever
    Fields - fldInfo(whatever data type), fldDate(date/time data type)

    on your form, have a textbox bound to the fldDate column. on the AfterUpdate event of the fldInfo textbox, just put in:
    Code:
    fldDate.value=Now()
    when the user creates a new record, the date will automatically be filled in for each record. did i just tell you stuff you already know?


    Originally posted by High_D
    What it's supposed to be doing is placing a date/time stamp on the record. I placed it as a default value b/c it should never be blank, and should be populated only when the record is created.

  5. #5
    Join Date
    Mar 2004
    Posts
    83
    I had considered that, however if the user then updates any data in the record will it not re-stamp a new date into fldDate?

  6. #6
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271

    Not Null

    Try using not null in any field other than the date when you go to print.
    Gotta to do some code

  7. #7
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    Okay to restamp the field... I do this all the time. My coding is a bit large since I cant seem to get a module to work for this yet.

    I put coding in the Change() event of every field.

    I keep track of the date it was originally put in and then a date it was changed.

    So...

    Code:
    Option Compare Database
    Dim TDate
    
    Private Sub fld1_Change()
        TDate = DateTime.Date
        yourDateFldhere.Value = TDate
    End Sub
    
    Private Sub fld2_Change()
        TDate = DateTime.Date
        yourDateFldhere.Value = TDate
    End Sub
    And so on and so forth till you have the change event on every form field.

    Hope this helps... I also for my initial date created I put a default value in the form instead of the table. That way when they goto a new record it defaults the date.
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

Posting Permissions

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