Connecting Tech Pros Worldwide Help | Site Map

Autocomplete in Access

  #1  
Old July 2nd, 2009, 03:38 PM
Newbie
 
Join Date: May 2009
Posts: 9
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!!
  #2  
Old July 2nd, 2009, 04:14 PM
beacon's Avatar
Needs Regular Fix
 
Join Date: Aug 2007
Posts: 279
Provided Answers: 1

re: Autocomplete in Access


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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub StartDate_AfterUpdate()
  2.      If vbYes = MsgBox("Is the end date the same as the start date?", vbYesNo) then
  3.           EndDate = StartDate
  4.      Else
  5.           'Do Nothing
  6.      End If
  7. End Sub
  8.  
  #3  
Old July 2nd, 2009, 09:15 PM
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 2,970
Provided Answers: 11

re: Autocomplete in Access


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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub StartDate_AfterUpdate()
  2.   Me.EndDate = Me.StartDate
  3. End Sub
Welcome to Bytes!

Linq ;0)>
  #4  
Old July 3rd, 2009, 04:15 PM
beacon's Avatar
Needs Regular Fix
 
Join Date: Aug 2007
Posts: 279
Provided Answers: 1

re: Autocomplete in Access


Quote:
Originally Posted by missinglinq View Post
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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub StartDate_AfterUpdate()
  2.   Me.EndDate = Me.StartDate
  3. 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.
  #5  
Old July 3rd, 2009, 06:49 PM
missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 2,970
Provided Answers: 11

re: Autocomplete in Access


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)>
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoComplete in datagridviewtextboxcolumn not working =?Utf-8?B?cG1haw==?= answers 0 June 27th, 2008 09:17 PM
Autocomplete textboxes mashimaro answers 3 January 24th, 2008 04:00 AM
A combo box as the Access compo box giannis answers 6 February 18th, 2007 12:25 AM
UI question: using AutoComplete in a broader sense? Pete answers 3 November 12th, 2005 07:01 PM