Hi,
If you are using a pop up form from the main form, then the date needs to be in a seperate table that looks up to the main table/form for the PK. Then store this date in a seperate table associated to the main table.
You can also put the calendar control on the main form if you want to store the date in the main table.
Use the control's properties dialog box to associate the date with the proper field.
Then to set the date to default to the last day of the current month, you would have to set a default value in the field property in the table, or on the form control.
I wrote this function that gets you the last day of the month, but I am not sure where to put it to get it to work.
'====================================
Function EndMonth()
Dim strDate As Date
Dim strNxMonth As Date
Dim strEndMonth As Date
strDate = Date
strNxMonth = DateAdd("m", 1, strDate)
strEndMonth = strNxMonth - DatePart("d", strNxMonth)
EndMonth = strEndMonth
End Function
'==============================================
Dang, that's the problem with VBA. I can do this stuff in VBScript all day, but I am not sure where it goes in VBA to get it store the value in the table. The field's default value property won't recognize the function.
I hope this gets you started. Please let me know if and how you resolve this.
mmcdonal
|