I'm getting an error on the .UPDATE stating
Run time error '3146'
ODBC call failed
Here is my code and any suggestions would be great.
Dim rst As Recordset
Dim key1, key2, key3, key4 As String
Dim insertMonth As Date
nInsert = 1
insertMonth = comboInsMonth.Value
Set rst = CurrentDb.OpenRecordset("Select * from [MonthlyInput] Order by HICode, CurrentMonth", dbOpenDynaset)
Forms!v2_CompanyPolicy.Refresh
key1 = [Forms]![v2_CompanyPolicy]![textHICode]
key2 = insertMonth
With rst
.FindFirst "[HICode] & STR([CurrentMonth]) = '" & key1 & Str(key2) & "'"
If rst.NoMatch = True Then
.AddNew
!HICODE = [Forms]![v2_CompanyPolicy]![textHICode]
!CurrentMonth = insertMonth '[Forms]![Commissions]![Child36]![CurrentMonth]
.Update
.Close
End If
End With
THANKS!
Run time error '3146'
ODBC call failed
Here is my code and any suggestions would be great.
Dim rst As Recordset
Dim key1, key2, key3, key4 As String
Dim insertMonth As Date
nInsert = 1
insertMonth = comboInsMonth.Value
Set rst = CurrentDb.OpenRecordset("Select * from [MonthlyInput] Order by HICode, CurrentMonth", dbOpenDynaset)
Forms!v2_CompanyPolicy.Refresh
key1 = [Forms]![v2_CompanyPolicy]![textHICode]
key2 = insertMonth
With rst
.FindFirst "[HICode] & STR([CurrentMonth]) = '" & key1 & Str(key2) & "'"
If rst.NoMatch = True Then
.AddNew
!HICODE = [Forms]![v2_CompanyPolicy]![textHICode]
!CurrentMonth = insertMonth '[Forms]![Commissions]![Child36]![CurrentMonth]
.Update
.Close
End If
End With
THANKS!