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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error '3155' ODBC--insert on a linked table ... failed

Status
Not open for further replies.

daveinchicago

IS-IT--Management
Feb 13, 2012
19
US
Dim strSQL As String
If IsNull(Me.Text18) Then
MsgBox "Note not entered!"
Cancel = True
Exit Sub
Else:
End If
strSQL = "Insert Into dbo_COMPLIANCE_ACCT_NOTE(ACCT_CD, ACCT_NOTE) Values ('" & Me.cboAcName & "','" & Me.Text18 & "')"
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError + dbSeeChanges
Me.sfRULENOTE.Form.Requery


using the above code I am getting a 3155 runtime error. not sure why. any help would be appreciated. thanks.
 
Can you show us the result of the debug.print (glad to see you are using this)?

I would like to think you are being penalized for not renaming Text18 but that's my world. Does this control possibly contain an apostrophe in the text?

I asked about primary keys in a previous thread but you didn't answer.

Duane
Hook'D on Access
MS Access MVP
 
All the tables have primary keys... sorry.

The problem with this was permissioning on the sql server.

Thank you for your help.. it really is appreciated!!
 
Me.Text18 usually means there's 17 more grrrrrr :)

just a side note

your if statement ends with no else??
Code:
Dim strSQL As String
If IsNull(Me.Text18) Then
MsgBox "Note not entered!"
Cancel = True
Exit Sub
    Else:
    End If
        strSQL = "Insert Into dbo_COMPLIANCE_ACCT_NOTE(ACCT_CD, ACCT_NOTE) Values ('" & Me.cboAcName & "','" & Me.Text18 & "')"
        Debug.Print strSQL
        CurrentDb.Execute strSQL, dbFailOnError + dbSeeChanges
        Me.sfRULENOTE.Form.Requery

possibly this is what was intended?

Code:
    Dim strSQL As String
    If IsNull(Me.Text18) Then
        MsgBox "Note not entered!"
        Cancel = True
        Exit Function
    Else
        strSQL = "Insert Into dbo_COMPLIANCE_ACCT_NOTE(ACCT_CD, ACCT_NOTE) Values ('" & Me.cboAcName & "','" & Me.Text18 & "')"
        Debug.Print strSQL
        CurrentDb.Execute strSQL, dbFailOnError + dbSeeChanges
        Me.sfRULENOTE.Form.Requery
    End If

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top