psycoperl
Active Member
- Joined
- Oct 23, 2007
- Messages
- 338
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
- Web
Good Afternoon,
i am working on a project that based on today's date, we would want to have certain default constants be set.
I have a table called tblTerm which has the following fields termID, termDescLong, termDescShort, termDefaultStart, termDefaultEnd which contains what the default values should be.
For example, as today is 9/11/2014 i would use the termID of 1149; however if it was 10/5/2014 i would use the termID 1152
using in my basGlobal module
I receive a Compile Error: Constant Expression Required.
Can someone please provide a potential solution to this as I would like to just beable to use the "ATBAS_TermID" variable when I need to insert the termID without recalculating it every time that i need to call it.
i am working on a project that based on today's date, we would want to have certain default constants be set.
I have a table called tblTerm which has the following fields termID, termDescLong, termDescShort, termDefaultStart, termDefaultEnd which contains what the default values should be.
For example, as today is 9/11/2014 i would use the termID of 1149; however if it was 10/5/2014 i would use the termID 1152
Code:
termID termDescLong termDescShort termDefaultStart termDefaultEnd
1149 Incoming Fall 2014 FA-14 3/1/2014 9/30/2014
1152 Incoming Spring 2015 SP-15 10/1/2014 2/28/2015
using in my basGlobal module
Code:
Public Const ATBAS_TermID As String = DLookup("[termID]", "tblTerm", "[termDefaultEnd] >=#" & Date() & "# AND [termDefaultStart] <= #" & Date() & "#")
I receive a Compile Error: Constant Expression Required.
Can someone please provide a potential solution to this as I would like to just beable to use the "ATBAS_TermID" variable when I need to insert the termID without recalculating it every time that i need to call it.