J
jsrogol
I'm trying to create a date in a form and then insert the date into a table
but can't seem to get the coding correct. I know the first part works but the
insert into command generates the error: "too few parameters. Expected 1".
I would appreciate any help. This code is on an exit event in a form.
Dim year As Integer
Dim month As Integer
Dim NextMonth As Integer
Dim SearchDate As Date
Dim db As DAO.Database
month = Me.cboMonth
year = Me.cboYear
If month = 12 Then
NextMonth = 1
year = year + 1
SearchDate = CDate([NextMonth] & "/1/" & year)
Else
NextMonth = month + 1
SearchDate = CDate([NextMonth] & "/1/" & year)
End If
Set db = CurrentDb()
db.Execute "INSERT INTO refLookupSearchDate (SearchDate)" & _
" SELECT SearchDate AS SearchDate;"
but can't seem to get the coding correct. I know the first part works but the
insert into command generates the error: "too few parameters. Expected 1".
I would appreciate any help. This code is on an exit event in a form.
Dim year As Integer
Dim month As Integer
Dim NextMonth As Integer
Dim SearchDate As Date
Dim db As DAO.Database
month = Me.cboMonth
year = Me.cboYear
If month = 12 Then
NextMonth = 1
year = year + 1
SearchDate = CDate([NextMonth] & "/1/" & year)
Else
NextMonth = month + 1
SearchDate = CDate([NextMonth] & "/1/" & year)
End If
Set db = CurrentDb()
db.Execute "INSERT INTO refLookupSearchDate (SearchDate)" & _
" SELECT SearchDate AS SearchDate;"