Dateserial function

  • Thread starter Thread starter Chieko Kuroda
  • Start date Start date
C

Chieko Kuroda

hello,
I am trying to determine the first day of the current month using
curday = DateSerial(Year([FirstDate]), Month([FirstDate], 1) 'first day of
month
the [FirstDate] is a field in my form formatted to short date and a default
value of date(),
and curday is a date value ie. 'dim curday As Date'.
Everytime I run the function the form stops and tells me that I have and
invalid data type at the month function.

While I'm in the vb designer in the debugger mode when I hover over 'year'
with the cursor nothing pops up, but when I hover over 'month' I get
"Month=<invalid datatype>".
Does anybody know how to correct this error?
Chieko
 
Chieko Kuroda said:
hello,
I am trying to determine the first day of the current month using
curday = DateSerial(Year([FirstDate]), Month([FirstDate], 1) 'first day of
month
the [FirstDate] is a field in my form formatted to short date and a default
value of date(),
and curday is a date value ie. 'dim curday As Date'.
Everytime I run the function the form stops and tells me that I have and
invalid data type at the month function.

While I'm in the vb designer in the debugger mode when I hover over 'year'
with the cursor nothing pops up, but when I hover over 'month' I get
"Month=<invalid datatype>".

If what you have posted here is an exact copy of your code you have a
missing closing parenthesis before the final comma.


Instead of...
DateSerial(Year([FirstDate]), Month([FirstDate], 1)

It should be...
DateSerial(Year([FirstDate]), Month([FirstDate]), 1)
 
Back
Top