Results 1 to 7 of 7
  1. #1
    MikeDBMan is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Location
    Stillwater, Oklahoma
    Posts
    23

    Date Record Entered


    I have a field that I wish to store today's date in if the field is empty. If the field has data in it, I wish it to not be changed by users. I believe I need to use the expression builder but have been unsuccessful with creating the right formula. Please help. The field name is 'Date Added'. Thanks.

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    You can only limit this by using a form. And putting code in the form's On Current event. You can use:
    Code:
    Me.NameOfTextBoxHere.Locked = (Len(Me.NameOfTextBoxHere & vbNullString) > 0)

  3. #3
    LillMcGill is offline Dagny fan
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2010
    Location
    Southern USA
    Posts
    70
    create a query that produces records where Date Added is null. Look at the results to check that the correct records were produced. If so, change the query to an Update query. in the Update to field for Date Added, enter the function Date()

    Run the query by using the Run button (red exclamation). Check your table... the date added field has been changed.

  4. #4
    MikeDBMan is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Location
    Stillwater, Oklahoma
    Posts
    23

    On Current Event

    I can't seem to locate the On Current Event. I see:
    On Click
    On Dbl Click
    On Mouse Down
    On Mouse UP
    On Mouse Move
    On Paint

    Where is On Current?

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Okay, looks like I may have misread the original post a bit. If you want to add the date to the record you can use the form's before update event to add it if empty:

    Code:
    If IsNull(Me!DateFieldNameHere) Then 
       Me!DateFieldNameHere = Date
    End If
    And Date by the way is typed in there as shown. In a control source or query it is Date() but in VBA it is just Date.

    So now you have a couple of different ways depending on how exactly you are wanting it.

  6. #6
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by MikeDBMan View Post
    I can't seem to locate the On Current Event. I see:
    On Click
    On Dbl Click
    On Mouse Down
    On Mouse UP
    On Mouse Move
    On Paint

    Where is On Current?
    You have to select the Form first from the drop down on the left (if you are in the VBA window) or from the object list from the form's properties dialog if looking at the form in design view. You apparently have a control selected and not the form object.

  7. #7
    MikeDBMan is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Location
    Stillwater, Oklahoma
    Posts
    23

    Record Date Entered

    Thanks, Bob. Your second solution does what I wish to have happen.

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

Similar Threads

  1. Replies: 4
    Last Post: 07-27-2011, 12:42 PM
  2. Replies: 1
    Last Post: 07-17-2011, 09:02 PM
  3. Replies: 1
    Last Post: 11-25-2010, 11:00 AM
  4. Replies: 1
    Last Post: 09-19-2009, 09:37 AM
  5. one date entered to hit 3 fields in one table how?
    By techexpressinc in forum Queries
    Replies: 0
    Last Post: 12-10-2008, 10:43 AM

Tags for this Thread

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