Autocomplete in Access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fluffygoldfish
    New Member
    • May 2009
    • 11

    Autocomplete in Access

    Hi

    In my database I have a table to record absence. The table has a start date column and an end date column. As staff seem to often have one day bugs (a seperate issue to work out!!), I would like the end date column to automatically populate with the date that was put in the start column. But also allow it to be written over should they have something more serious!

    I'm fairly new to access still, so hopefully its not too complex?

    Thanks in advance for your help!!
  • beacon
    Contributor
    • Aug 2007
    • 579

    #2
    Hi Fluffy,

    Personally, I would prompt the user. That way they can have the choice to populate it with the date or not and you won't have to worry about whether the user won't be able to overwrite the date that is populated.

    I would use something like the following code to achieve this:
    Code:
    Private Sub StartDate_AfterUpdate()
         If vbYes = MsgBox("Is the end date the same as the start date?", vbYesNo) then
              EndDate = StartDate
         Else
              'Do Nothing
         End If
    End Sub

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      Nothing at all wrong with doing that, especially if the absence StartDate and EndDate are not always entered at the same time. This allows the date to be overwritten:
      Code:
      Private Sub StartDate_AfterUpdate()
        Me.EndDate = Me.StartDate
      End Sub
      Welcome to Bytes!

      Linq ;0)>

      Comment

      • beacon
        Contributor
        • Aug 2007
        • 579

        #4
        Originally posted by missinglinq
        Nothing at all wrong with doing that, especially if the absence StartDate and EndDate are not always entered at the same time. This allows the date to be overwritten:
        Code:
        Private Sub StartDate_AfterUpdate()
          Me.EndDate = Me.StartDate
        End Sub
        Welcome to Bytes!

        Linq ;0)>
        Good call Linq. I thought about that, but I work with users that get complacent when things are done for them so I went this route instead. Either way, they're two good options to choose from.

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          My signature

          There's Always more than one way to skin a cat!

          kind of says it all! I try to stress, where appropriate, that many posters' situations are unique to them, and that [B]absolutely, positively don't/B]... should only be used when talking to your kids about drugs and alcohol! There are simply too many variables where absolutes don't apply. And the same goes for people responding to posts. Everyone trying to help is doing so based on their experiences. And you have to always keep that in mind!

          Linq ;0)>

          Comment

          Working...