If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Date Fields Automatically Filled In

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-30-03, 10:08
vbhelpme vbhelpme is offline
Registered User
 
Join Date: Oct 2003
Posts: 7
Question Date Fields Automatically Filled In

I am using Microsoft Access and I have a form that when one date (let's call it Date1) is entered by the user and they hit enter immediately right after, I would like Dates 2 and 3 to automatically prefill on the form. Based upon date 1, we need to add 20 days in the future to get Date2 and 40 days in the future to get Date3. Without using the DateAdd function, how would I write this using Visual Basic? Under the OnEnter Event, I've got this code so far:

Private Sub Date3_Enter()
Dim vntFuture40days As Variant

vntFuture40days = Format(Date1 + 40, "mm/dd/yyyy")

SendKeys vntFuture40days, 1
End Sub

The main problem is Date 2 automatically prefills in like I want, but in order for Date3 to prefill with the correct date, you have to either tab down to that field or hit enter in that field. How do I get around this so that the user hits enter one time only and Date 3 automatically prefills?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On