Sam Summers
Registered User.
- Local time
- Today, 08:33
- Joined
- Sep 17, 2001
- Messages
- 939
Hi Guys,
I have a final issue to resolve which shouldn't be too hard but is beyond my current skill level.
I have a form who's control source is a query which displays dates that personnel and equipment are mobilized.
For invoicing on a weekly basis i need to display the number of days within the week that these are on hire.
The mobilization and demobilization dates may be well outwith the weeks dates or may be within the week though.
For example MobDate 20/03/2014, DeMobDate 13/06/2014 but the week is this week.
or Mobdate 27/05/2014, DeMobDate Today 30/05/2014
I need to display the actual dates if within the current week or display the first day of the current week and the last day of the current week if the mobilization and demobilization dates are outwith the current weeks dates?
I have created two unbound textboxes MobTextBox and DeMobTextBox and am trying to use the code below to insert what i described above.
Once i have the dates inserted i have a third textbox with the ControlSource set to =DateDiff("d",[MobTextBox],[DeMobTextBox])
______________________________________________________________
Dim MobDate As Date
Dim DeMobDate As Date
Me.MobDate.SetFocus
If Me.MobDate.Text > (Date - 7) Then
Me.MobTextBox.Text = Me.MobDate.Text
Else
If Me.MobDate.Text < (Date - 7) And Me.DeMobDate > Date Then
Me.MobTextBox.Text = (Date - 7) And Me.DeMobTextBox.Text = Date
End If
End If
_____________________________________________________________
I hope this is clearly explained enough?
Many thanks in advance
I have a final issue to resolve which shouldn't be too hard but is beyond my current skill level.
I have a form who's control source is a query which displays dates that personnel and equipment are mobilized.
For invoicing on a weekly basis i need to display the number of days within the week that these are on hire.
The mobilization and demobilization dates may be well outwith the weeks dates or may be within the week though.
For example MobDate 20/03/2014, DeMobDate 13/06/2014 but the week is this week.
or Mobdate 27/05/2014, DeMobDate Today 30/05/2014
I need to display the actual dates if within the current week or display the first day of the current week and the last day of the current week if the mobilization and demobilization dates are outwith the current weeks dates?
I have created two unbound textboxes MobTextBox and DeMobTextBox and am trying to use the code below to insert what i described above.
Once i have the dates inserted i have a third textbox with the ControlSource set to =DateDiff("d",[MobTextBox],[DeMobTextBox])
______________________________________________________________
Dim MobDate As Date
Dim DeMobDate As Date
Me.MobDate.SetFocus
If Me.MobDate.Text > (Date - 7) Then
Me.MobTextBox.Text = Me.MobDate.Text
Else
If Me.MobDate.Text < (Date - 7) And Me.DeMobDate > Date Then
Me.MobTextBox.Text = (Date - 7) And Me.DeMobTextBox.Text = Date
End If
End If
_____________________________________________________________
I hope this is clearly explained enough?
Many thanks in advance