If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
default value
Help! I currently know how to create the following: =CDate(Month(Date()) &
"/10/" & Year(Date())) as a default value in "Access 2003". What value or expression can I use to create a "month" instead of a date value? |
#2
|
|||
|
|||
default value
-- LeRoy54 "LeRoy" wrote: Help! I currently know how to create the following: =CDate(Month(Date()) & "/10/" & Year(Date())) as a default value in "Access 2003". What value or expression can I use to create a "month" instead of a date value? |
#3
|
|||
|
|||
default value
On Thu, 13 Aug 2009 20:17:02 -0700, LeRoy
wrote: Help! I currently know how to create the following: =CDate(Month(Date()) & "/10/" & Year(Date())) as a default value in "Access 2003". What value or expression can I use to create a "month" instead of a date value? What do you want in this "month"? An Access Date/Time value cannot be just a month - it's actually stored as a number, a count of days since midnight, December 30, 1899. As such any date value refers to a specific moment of time. It's not clear what you're trying to create! -- John W. Vinson [MVP] |
#4
|
|||
|
|||
default value
This function may be a little better as it creates a date which is the
tenth of the current month. DateSerial(Year(date()),Month(Date()),10) What do you mean by 'create a "Month"'? Do you want a month name, a month number, a date range from the 1st of the month to the last day of the month, or something else? You can use the Format function to get the month name Format(somedate,"mmmm") or Format(SomeDate,"mmm") You can use the MonthName function MonthName(8) returns August You can use DatePart to get the month number DatePart("m",SomeDate) '================================================= === John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County '================================================= === John W. Vinson wrote: On Thu, 13 Aug 2009 20:17:02 -0700, LeRoy wrote: Help! I currently know how to create the following: =CDate(Month(Date()) & "/10/" & Year(Date())) as a default value in "Access 2003". What value or expression can I use to create a "month" instead of a date value? What do you want in this "month"? An Access Date/Time value cannot be just a month - it's actually stored as a number, a count of days since midnight, December 30, 1899. As such any date value refers to a specific moment of time. It's not clear what you're trying to create! |
#5
|
|||
|
|||
default value
I use it as part of a default value in a field name (in a access table) when
to set as default date to keep from retyping a date when I open and use it on a form. Also, how do I make it go backward one month, If I don't want to use it as a current month. -- LeRoy54 "John Spencer" wrote: This function may be a little better as it creates a date which is the tenth of the current month. DateSerial(Year(date()),Month(Date()),10) What do you mean by 'create a "Month"'? Do you want a month name, a month number, a date range from the 1st of the month to the last day of the month, or something else? You can use the Format function to get the month name Format(somedate,"mmmm") or Format(SomeDate,"mmm") You can use the MonthName function MonthName(8) returns August You can use DatePart to get the month number DatePart("m",SomeDate) '================================================= === John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County '================================================= === John W. Vinson wrote: On Thu, 13 Aug 2009 20:17:02 -0700, LeRoy wrote: Help! I currently know how to create the following: =CDate(Month(Date()) & "/10/" & Year(Date())) as a default value in "Access 2003". What value or expression can I use to create a "month" instead of a date value? What do you want in this "month"? An Access Date/Time value cannot be just a month - it's actually stored as a number, a count of days since midnight, December 30, 1899. As such any date value refers to a specific moment of time. It's not clear what you're trying to create! |
#6
|
|||
|
|||
default value
This expression
DateSerial(Year(Date()), Month(Date())-1,10) will return the tenth day of the previous month. '================================================= === John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County '================================================= === LeRoy54 wrote: I use it as part of a default value in a field name (in a access table) when to set as default date to keep from retyping a date when I open and use it on a form. Also, how do I make it go backward one month, If I don't want to use it as a current month. |
#7
|
|||
|
|||
default value
On Sat, 15 Aug 2009 23:07:01 -0700, LeRoy54
wrote: I use it as part of a default value in a field name (in a access table) when to set as default date to keep from retyping a date when I open and use it on a form. Also, how do I make it go backward one month, If I don't want to use it as a current month. You can't use a function in a table default value... but you can use =DateSerial(Year(Date()), Month(Date()) - 1, 10) as the default value of a textbox on a Form to get the tenth of last month into the textbox's bound column. -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|