L
Lori2836 via AccessMonster.com
Good morning. I need a little help in trying to figure out how to write a
little code. We have a database that tracks all quotes. A quote is created,
engineering assigns a part number, then the costing department goes in and
enters the cost....and on down the line. These quotes are available even
after being closed out, so the labor rates have to stay the same. Each year,
the labor rates change and this is how it has been coded. I can't seem to
get the "between" to work. It was fine until the new rates came out. Then
I had to add between dates for "if [Date Initiated] between #5/17/2008# and
#4/16/2009# Then". I get a Compile error that says Expected: Then or Go To.
Can someone help? Or maybe there is a better way to write this?
Private Sub Hrs_Change()
If IsNumeric(Hrs.Text) Then
If [Date Initiated] < #5/16/2008# Then
Unit_Cost1.Value = CDbl(Hrs.Text) * 99.55 / 1000
Unit_Cost2.Value = CDbl(Hrs.Text) * 99.55 / 1000
Unit_Cost3.Value = CDbl(Hrs.Text) * 99.55 / 1000
Unit_Cost4.Value = CDbl(Hrs.Text) * 99.55 / 1000
Unit_Cost5.Value = CDbl(Hrs.Text) * 99.55 / 1000
End If
or
if [Date Initiated] between #5/17/2008# and #4/16/2009# Then
Unit_Cost1.Value = CDbl(Hrs.Text) * 100.9 / 1000
Unit_Cost2.Value = CDbl(Hrs.Text) * 100.9 / 1000
Unit_Cost3.Value = CDbl(Hrs.Text) * 100.9 / 1000
Unit_Cost4.Value = CDbl(Hrs.Text) * 100.9 / 1000
Unit_Cost5.Value = CDbl(Hrs.Text) * 100.9 / 1000
End If
or
If [Date Initiated] > #4/17/2009# Then
Unit_Cost1.Value = CDbl(Hrs.Text) * 108.6 / 1000
Unit_Cost2.Value = CDbl(Hrs.Text) * 108.6 / 1000
Unit_Cost3.Value = CDbl(Hrs.Text) * 108.6 / 1000
Unit_Cost4.Value = CDbl(Hrs.Text) * 108.6 / 1000
Unit_Cost5.Value = CDbl(Hrs.Text) * 108.6 / 1000
End If
Thanks,
Lori
little code. We have a database that tracks all quotes. A quote is created,
engineering assigns a part number, then the costing department goes in and
enters the cost....and on down the line. These quotes are available even
after being closed out, so the labor rates have to stay the same. Each year,
the labor rates change and this is how it has been coded. I can't seem to
get the "between" to work. It was fine until the new rates came out. Then
I had to add between dates for "if [Date Initiated] between #5/17/2008# and
#4/16/2009# Then". I get a Compile error that says Expected: Then or Go To.
Can someone help? Or maybe there is a better way to write this?
Private Sub Hrs_Change()
If IsNumeric(Hrs.Text) Then
If [Date Initiated] < #5/16/2008# Then
Unit_Cost1.Value = CDbl(Hrs.Text) * 99.55 / 1000
Unit_Cost2.Value = CDbl(Hrs.Text) * 99.55 / 1000
Unit_Cost3.Value = CDbl(Hrs.Text) * 99.55 / 1000
Unit_Cost4.Value = CDbl(Hrs.Text) * 99.55 / 1000
Unit_Cost5.Value = CDbl(Hrs.Text) * 99.55 / 1000
End If
or
if [Date Initiated] between #5/17/2008# and #4/16/2009# Then
Unit_Cost1.Value = CDbl(Hrs.Text) * 100.9 / 1000
Unit_Cost2.Value = CDbl(Hrs.Text) * 100.9 / 1000
Unit_Cost3.Value = CDbl(Hrs.Text) * 100.9 / 1000
Unit_Cost4.Value = CDbl(Hrs.Text) * 100.9 / 1000
Unit_Cost5.Value = CDbl(Hrs.Text) * 100.9 / 1000
End If
or
If [Date Initiated] > #4/17/2009# Then
Unit_Cost1.Value = CDbl(Hrs.Text) * 108.6 / 1000
Unit_Cost2.Value = CDbl(Hrs.Text) * 108.6 / 1000
Unit_Cost3.Value = CDbl(Hrs.Text) * 108.6 / 1000
Unit_Cost4.Value = CDbl(Hrs.Text) * 108.6 / 1000
Unit_Cost5.Value = CDbl(Hrs.Text) * 108.6 / 1000
End If
Thanks,
Lori