Results 1 to 13 of 13
  1. #1
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85

    Control with suffix

    Ok I need some help...

    I have a control named "DCV" on my form that is linked to a table named "Research".
    "DCV" is a text field. I would like to enter my 4 digit number into the "DCV" field and when I exit (any event) the field I would like the current date to populate next to the 4 digit code.

    example:
    If I type in 4601
    When I exit the field, I would like it to contain: 4601_05/10/2013 (representing today's date)

    Is this even possible without creating an additional field and performing an update query?
    Thanks,


    Lisa

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why do you need to combine data? It would be easier to have a separate field with a DefaultValue of Date().
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    If it is possible to have 2 different Date() associated with 2 different fields that would be great.
    Is this possible?
    I have 2 fields that when they are populated I would like the Date field to represent the auto date the fields were populated.
    For Example:
    My field names are: Researched By: and Purged By: lets say that the person that researched the data completed the research on 5/8/2013 and the date the other person purged the documents was 5/10/2013.
    I would like the the data to look lik this:
    Research By | Research Date | Purged By | Purged Date
    0204 05/08/2013 2027 05/10/2013

    I would like the dates to auto populate when the Research By field is exited.
    Thanks,
    Lisa

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    As June7 has mentioned, in relational databases the best practice is to use atomic data -- that is one fact in one field.
    You can have as many relevant dates as you need to support your business. Each fact/field needs to have a unique name to distinguish one from another. You may want to research NORMALIZATION, a method for designing and relating tables.
    Here is one link, there are many "findable" via Google search,
    http://support.microsoft.com/kb/283878

  5. #5
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    So you can not provid me with an example with the data I have provided?

  6. #6
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    It is best to work with your data but the Northwind Database which comes with Access will show you a correct setup.

    Are you going to post your Relationship window or are you having problems.
    Last edited by Rainlover; 05-13-2013 at 08:29 AM. Reason: Spelling

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Example of what? You showed only 4 fields. What sort of research? How many researchers? Locations? Reasons/rationale?
    What is the Business and business rules? How many tables involved? What relationships?

    Here's your own example of multiple Dates
    Code:
    Research By | Research Date | Purged By | Purged Date
      0204            05/08/2013       2027           05/10/2013
    Whatever DCV is -control, field in a table.... - it should be separate.
    If the DCV code number is important to you, then you name it and value it as you see fit.
    I recommend you have a Primary key on your table(s), that has meaning to Access. I would recommend this be autonumber.

    You could automatically assign a Date to a field via an Event Procedure.
    eg, AfterUpdate of PurgeBy, you could assign Date() to PurgedDate.

    I also recommend you do NOT use names with embedded spaces, or other special characters (!@#$%^&*+-=)

  8. #8
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    Ok, I will try and explain what I am wanting one more time.
    I have a form that is linked to a table which contains many data elements.
    When staff types in information into the "Research By" field I would like for the "Research date" to be auto populated with the Date() it was actually keyed.
    When the next staff person enters information in the "Purged By" field I would like for the "Purge Date" to be auto populated with the Date() it was actually keyed.

    So, is there code that can be written if the "Research By" field is updated then populate the "Research Date" field with Date()? and
    if the "Purge By" field is updated then populate the "Purge Date" field with Date()?

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    As per my last post

    You could automatically assign a Date to a field via an Event Procedure.
    eg, AfterUpdate of PurgeBy, you could assign Date() to PurgedDate.


    Sample code(an existing AfterUpdate event not specific to your issue) - just an example of an AfterUpdate

    Code:
    Private Sub cboShift_AfterUpdate()
       Me.txtShiftStartDate = Format(Now, "mm/dd/yyyy hh:nn:ss")
    End Sub
    Last edited by orange; 05-13-2013 at 09:14 AM. Reason: clarification of the sample

  10. #10
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Me.NameOfDateField = Date()

    That's all you need in the event.

    I am sure Orange understands your problem.

  11. #11
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    I will try this thanks.

  12. #12
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    One other thing.

    Date() will return today's Date.

    Now() will Return today's Date plus the time it is now.

  13. #13
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    Rainlover, thanks alot....this worked.

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

Similar Threads

  1. Replies: 10
    Last Post: 02-20-2013, 07:04 AM
  2. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  3. Replies: 5
    Last Post: 10-13-2011, 03:36 PM
  4. Replies: 6
    Last Post: 03-14-2011, 09:37 AM
  5. File name with date and Time suffix
    By keyies in forum Access
    Replies: 0
    Last Post: 04-29-2010, 05:10 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