Here is the entire code. It works the way it is but requires the user to input 12/31 of the year in [argdate]. Note the comment in the code where I want to eliminate the user having to input the last day of the year in the form textbox [argenddate]. I thought is would easy to get the number of days left in the year and use that value to set the last day.
Function fnFirstDayInMonth(Optional dtmDate As Date = 0) As Date
Dim rst As Recordset
Dim qdf As QueryDef
Set db = CurrentDb()
Dim MonthDays As Integer
Dim nStartDate As Date
For nStartDate = (Forms![Annual Vendor Budget Input]![argdate]) To (Forms![Annual Vendor Budget Input]![argenddate]) + MonthDays
' I am trying to eliminate this textbox [argenddate]on the form
dmonth = DatePart("m", nStartDate)
Monthtxt = MonthName(Month(nStartDate))
fnFirstDayInMonth = DateSerial(Year(nStartDate), Month(nStartDate), 1)
MonthDays = DateSerial(Year(nStartDate), Month(nStartDate) + 1, 1) - DateSerial(Year(nStartDate), Month(nStartDate), 1)
Debug.Print "nStartDate " & nStartDate & " # of Days in StartDate " & MonthDays & " Value of fnFirstDayinMonth " & fnFirstDayInMonth & " Month#:" & dmonth & "Monthtxt: " & Monthtxt
nStartDate = nStartDate + MonthDays
Set rst = CurrentDb.OpenRecordset("SELECT * FROM [Vendor Budget]")
With rst
.AddNew
![IncomeDate] = fnFirstDayInMonth
![VENDOR] = Forms![Annual Vendor Budget Input]!CmbVendor
![Budget Income] = Forms![Annual Vendor Budget Input]!BudgetIncome
![Actual Income] = Forms![Annual Vendor Budget Input]!BudgetIncome
![Year] = Forms![Annual Vendor Budget Input]!xyear
![Month] = dmonth
![Month Text] = Monthtxt
.Update
End With
rst.Close
Next nStartDate
MsgBox " Records Added for " & Forms![Annual Vendor Budget Input]!CmbVendor & " for " & Forms![Annual Vendor Budget Input]!xyear
End Function