Astronomyman
New member
- Local time
- Today, 22:10
- Joined
- Jan 14, 2017
- Messages
- 4
I want to fill a default value on a form field using a function that displays the membership fee based on the current month (which is pro-rata)
I have a table with the month number and fee [tblSubscriptionTable]:
SubscriptionID SubscriptionMonth SubscriptionAmmount DateNumber
2 Jul £20.00 01/07/1900 7
3 Aug £20.00 01/08/1900 8
4 Sep £20.00 01/09/1900 9
5 Oct £18.00 01/10/1900 10
6 Nov £16.00 01/11/1900 11
7 Dec £14.00 01/12/1900 12
8 Jan £12.00 01/01/1900 1
9 Feb £10.00 01/02/1900 2
10 Mar £8.00 01/03/1900 3
11 Apr £6.00 01/04/1900 4
12 May £4.00 01/05/1900 5
13 Jun £3.50 01/06/1900 6
The function reads like this:
Function GetDefaultFEE() As Long
GetDefaultFEE = Nz(DLookup([DateNumber],[tblSubscriptionTable]), 20)
End Function
Not sure how to best select Month(date) to equate to the [DateNumber] field
should I use the IIF, SWITCH or CASE statements to achieve this?
I have a table with the month number and fee [tblSubscriptionTable]:
SubscriptionID SubscriptionMonth SubscriptionAmmount DateNumber
2 Jul £20.00 01/07/1900 7
3 Aug £20.00 01/08/1900 8
4 Sep £20.00 01/09/1900 9
5 Oct £18.00 01/10/1900 10
6 Nov £16.00 01/11/1900 11
7 Dec £14.00 01/12/1900 12
8 Jan £12.00 01/01/1900 1
9 Feb £10.00 01/02/1900 2
10 Mar £8.00 01/03/1900 3
11 Apr £6.00 01/04/1900 4
12 May £4.00 01/05/1900 5
13 Jun £3.50 01/06/1900 6
The function reads like this:
Function GetDefaultFEE() As Long
GetDefaultFEE = Nz(DLookup([DateNumber],[tblSubscriptionTable]), 20)
End Function
Not sure how to best select Month(date) to equate to the [DateNumber] field
should I use the IIF, SWITCH or CASE statements to achieve this?