Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL AddNew - Update

Status
Not open for further replies.

Vcscwi

Programmer
Jan 15, 2004
57
US
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!
 
I realized I pressed submit with out giving all the info.

Its a SQL 2000 and MS Access XP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top