1

Below query is resulting zero rows updated

but i am sure that there is a record to update

DoCmd.RunSQL (" Update tbltesting set IsDiff ='Yes' " & _
                "where empid= " & Me.txtEmpId.Value & _
                " and testid= " & Me.txtAutoNumber.Value & ";")

Please help!!

1
  • If you want to receive good answers to your questions, I suggest you not post them multiple times. Commented Jul 23, 2009 at 1:22

4 Answers 4

1

Run this as a check to make sure your fields have the data that you think they have:

DoCmd.RunSQL (" SELECT * FROM tbltesting " & _
                "WHERE empid= " & Me.txtEmpId.Value & _
                " and testid= " & Me.txtAutoNumber.Value & ";")

Incidentally, you can leave off the .Value portion.

Sign up to request clarification or add additional context in comments.

1 Comment

No problem. Glad you got it straightened out.
0

Maybe you need single quotes around the WHERE parameters:

DoCmd.RunSQL (" Update tbltesting set IsDiff ='Yes' where empid= '" & Me.txtEmpId.Value & "' and testid= '" & Me.txtAutoNumber.Value & "';")

1 Comment

No, we've already covered this in the OPs original thread. :(
0

Try removing .Value and ; If it still not updating then change 'Yes' to 1.

You can also try Yes without single quotes.

2 Comments

The value of True in Access and Jet/ACE is -1, not 1. However, using 1 here actually does work when appending to a Boolean field, because True (-1) is really defined as Not False. I would use True without quotes if I were writing this SQL.
"Boolean field" -- oxymoron. SQL data types can be NULL and the Access database engine's YESNO data type is no exception. Three value logic does not equal Boolean.
0

In debug mode cut and paste the delete statement with the actual values into whatever database development environment you are using - run the query in the data base this will tell you if there is a syntax problem or data problem

Comments