Ali Edwards
Registered User.
- Local time
- Today, 07:45
- Joined
- Apr 19, 2001
- Messages
- 68
Please help - I'm pulling my hair out!
When I get a sale I want to check which month it is and add the amount to a field. I have a field for MaySales, JuneSales etc so I'll use similar code for each month, changing the month each time.
I'm currently doing this on the 'on exit' event of the 'Ticket Spend' field although when I get it working it should probably go on the 'After Insert' event of the form (?).
My code is:
If Month(Date) = 5 Then
If [Forms]![MainForm]![subfrmSales].Form!MaySales = 0 Then
[Forms]![MainForm]![subfrmSales].Form!MaySales = Me.TicketSpend
Else
[Forms]![MainForm]![subfrmSales].Form!MaySales = [Forms]![MainForm]![subfrmSales].Form!MaySales.OldValue + Me.TicketSpend
End If
End If
It's not working!! It keeps adding a mystery amount each time!
Really grateful for any help!
Thanks
When I get a sale I want to check which month it is and add the amount to a field. I have a field for MaySales, JuneSales etc so I'll use similar code for each month, changing the month each time.
I'm currently doing this on the 'on exit' event of the 'Ticket Spend' field although when I get it working it should probably go on the 'After Insert' event of the form (?).
My code is:
If Month(Date) = 5 Then
If [Forms]![MainForm]![subfrmSales].Form!MaySales = 0 Then
[Forms]![MainForm]![subfrmSales].Form!MaySales = Me.TicketSpend
Else
[Forms]![MainForm]![subfrmSales].Form!MaySales = [Forms]![MainForm]![subfrmSales].Form!MaySales.OldValue + Me.TicketSpend
End If
End If
It's not working!! It keeps adding a mystery amount each time!
Really grateful for any help!
Thanks