Solved Date Picker value depending on another control

mafhobb

Registered User.
Local time
Today, 10:55
Joined
Feb 28, 2006
Messages
1,245
Hi
I have a continuous subform where I enter reservations. In this subform, I have a textbox "CheckInDate" where I enter the start date for the reservation using the date picker. Just below I have another textbox "CheckOutDate" where I enter the ending date of the reservation also using the date picker.
Right now, when I click on the date picker, it always shows today's date. This is Ok for the CheckInDate field, but is there any way to show that check in date value in the "CheckOutDate" textbox when I click on its date picker? This would speed things up qute a bit when entering a new reservation's info. Keep in mind thst this is all on a continuous form.
Thanks
mafhobb
 
Just use DateAdd() to set the other textbox with the number of days being booked.
 
but is there any way to show that check in date value in the "CheckOutDate" textbox
there is a way using VBA.
add code to CheckInDate Change Event:
Code:
Private Sub CheckInDate_Change()
Me.CheckOutDate = Me.CheckInDate.Text & ""
End Sub
 
Last edited:
there is a way using VBA.
add code to CheckInDate Change Event:
Code:
Private Sub CheckInDate_Change()
Me.ChecOutDate = Me.ChecInDate.Text & ""
End Sub
There should be a 'k' in there somewhere? :)
I only mention it, as so many people just copy without understanding the code. :(
 
already edited.
 
there is a way using VBA.
add code to CheckInDate Change Event:
Code:
Private Sub CheckInDate_Change()
Me.CheckOutDate = Me.CheckInDate.Text & ""
End Sub
Question: This will only affect the new record that is being entered, but not the other ones in the same continuous form, correct?
 
You add a Check if you are in NewRecord, so the code will only run on New Record:

Private Sub CheckInDate_Change()
If Me.NewRecord Then
Me.CheckOutDate = Me.CheckInDate.Text & ""
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom