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

Data Type Mismatch (3464) in SQL UPDATE string 2

Status
Not open for further replies.

larrydavid

Programmer
Jul 22, 2010
174
0
0
US
Hello,

I hope this isn't totally lame, but I've spent the past couple of hours beating my head against the wall (no more hair left) trying to find this data type mismatch. After saving a record I am trying to update a record in anmother table with a form id. I made sure that both ids in both tables are integers (numeric in Access) and the field I'm trying to update is a bit flag (Yes/No in Access).

Here is my VBA SQL statement which I am printing to the watch window and transferring to the Query Analyzer in SQL Server which executes perfectly. So, I'm thinking it's some Access-specifc syntax I'm missing, so any help is GREATLY appreciated as always:

Access VBA:
If Me.cboDisposition = "3" And (Me.txtComments <> Null Or Me.txtComments <> "") Then
strSQL = "UPDATE dbo_TESTTABLE SET [AdminPend] = '" & True & "' WHERE dbo_TESTTABLE.ID = '" & Me.ETID1 & "'"
dbs.Execute strSQL, dbSeeChanges
End If

Same query in SQL QA (which runs fine):
UPDATE dbo.TESTTABLE SET [AdminPend] = 'True'
WHERE dbo.TESTTABLE.ID = '152'

(AdminPend is a bit field with a default value of 0)
(ID is an int)

Thanks,
Larry
 
try:

strSQL = "UPDATE dbo_TESTTABLE SET [AdminPend] = -1 WHERE dbo_TESTTABLE.ID = " & Me.ETID1

If AdminPend is Yes/No field (Yes is -1, No is 0)
No quotes around ID if it is a Number

Have fun.

---- Andy
 
It worked, and I THANK YOU!!!
Best Regards,
larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top