B
Bob V
If I had a Button what On Click code would I need to increase the date 1 day
The text box [tbStartDate1]
Thanks for any help.....Bob
The text box [tbStartDate1]
Thanks for any help.....Bob
Cheese_whiz said:Hi Bob,
Assumming you want to increase the date in the same text box where the
date
appears:
____________
Sub cmdDatePush_click()
Me.tbStartDate1 = DateAdd("d", 1, Me.tbStartDate1)
End Sub
____________
You'll need to add an error handler, as per standard operating
procedure...
Hope that helps,
CW
Bob V said:If I had a Button what On Click code would I need to increase the date 1
day
The text box [tbStartDate1]
Thanks for any help.....Bob
JK said:If I understand you correctly you want yesterdays date if tbDayNo is
blank.
That being the case:
1. Set the default of the field (in table design) to:
Date()-1
2. To "catch" blank dates already in the table use the Current Event:
If Not Me.NewRecord then
Me.tbDayNo=IIf(Nz(Me.tbDayNo,0)=0,Date-1,Me.tbDayNo)
End If
3. In the AfterUpdate event of the field:
Me.tbDayNo=IIf(Nz(Me.tbDayno,0)=0,Date-1,Me.tbDayNo)
Regards
Jacob
| Me.tbDayNo = DateAdd("d", -1, Me.tbDayNo)
|
| tbDayNo.value = Format([tbDayNo], "dd-mmm-yy")
|
| Thanks Jacob fixed it with this code
| But Can I have an error catch on it
| If tbDayNo = "" -1 , Now
| Meaning if tbDayNo is Blank -1 from Now Date
| Does that make sense!
| Regards Bob
|
| | > Bob,
| >
| > The Format() function produces a *string* - Format(Date,"dd-mmm-yy")
will
| > produce the string "15-May-07". To apply format to a date use:
| >
| > Me.tbDayNo.Format="dd-mmm-yy"
| >
| > Regards
| > Jacob
| >
| >
| > | > | Cheese, I do have a problem with this, the date format should be
| > 12-May-07
| > | but when I use this control to change the date I am getting
12/5/2007,
I
| > | have tried this ,but not successful.............Thanks Bob
| > |
| > | Me.tbDayNo = DateAdd("d", 1, Me.tbDayNo)
| > | tbDayNo.value = Format("dd-mmm-yy")
| > |
message
| > | | > | > Hi Bob,
| > | >
| > | > Assumming you want to increase the date in the same text box where
the
| > | > date
| > | > appears:
| > | > ____________
| > | >
| > | > Sub cmdDatePush_click()
| > | >
| > | > Me.tbStartDate1 = DateAdd("d", 1, Me.tbStartDate1)
| > | >
| > | > End Sub
| > | > ____________
| > | >
| > | > You'll need to add an error handler, as per standard operating
| > | > procedure...
| > | >
| > | > Hope that helps,
| > | > CW
| > | >
| > | > "Bob V" wrote:
| > | >
| > | >>
| > | >>
| > | >> If I had a Button what On Click code would I need to increase the
| > date
| > 1
| > | >> day
| > | >> The text box [tbStartDate1]
| > | >> Thanks for any help.....Bob
| > | >>
| > | >>
| > | >>
| > |
| > |
| >
| >
|
|
Thanks Jacob, But not quiet it, I have this code on a control next to my
date box [tbDateNo] but if I click the Control and there is no date in
[tbDateNo] I get error [Type Mismatch] so I wanted to -1 one day form Now()
or maybe should I have a error message MsgBox "This does not contain a
date!"
Thanks Bob
Private Sub Command242_Click()
Me.tbDayNo = DateAdd("d", -1, Me.tbDayNo)
tbDayNo.value = Format([tbDayNo], "dd-mmm-yy")
End Sub