ADO Update Problem

H

Han

I have an UPDATE query that works successfully when executed in the query
window, but not from my module.

I create and open a connection like this:

Dim objConn As New ADODB.Connection
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db.mdb;"

The following code works as expected for INSERTs:

objConn.Execute "INSERT INTO Claimants (ClaimNum) VALUES ('123456')"

However, using the same code with UPDATE doesn't appear to do anything.

objConn.Execute "UPDATE Claimants SET Name = 'Mike' WHERE ClaimNum =
'123456'"

I don't get an error message, but the table is not updated. Again, running
the same query directly updates the table as expected.

I've tried every combination of single and double quotes with the same
results. That is, the query executes without error, but the update doesn't
happen.

I've also tried changing the connection mode (exp. "objConn.Mode = 3") to
various values, but no luck.

Is this a write permissions issue? If so, what's the solution? Why does
syntax work for INSERT, but not UPDATE?

Thanks in advance.
 
H

Han

Disregard my previous message.

The update works perfectly!

I was opening one data source, but looking at another (doh!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top