Thanks Chris! It gave me what I want!
enzo c",)?
http://www.tropangwatakwatak.tk
-----Original Message-----
From: Chris Scott [mailto:chris@e...]
Sent: Friday, January 03, 2003 10:48 PM
To: sql language
Subject: [sql_language] Re: How to know if an UPDATE is successfull is
done or not
Hi Enzo,
>
> I'm using VB6 and Access. I'm doing time stamp method in updating records.
> What I want to accomplish is I want to know whether if an update is
successful or not.
>
> My Test code:
> "UPDATE tblTest SET Field1=" & MyData & ", TimeStamp=#" & Now() & "# WHERE
TimeStamp =" & OrigTimeStamp
>
> The reason why I want to know if I made the update or not because I want
the user to be
> informed if he has successfully updated the record or somebody else has
updated the record
> first therefore giving him an option to reload the data or overwrite it.
>
> I was thinking of putting the select statement after the update then
comparing data to see
> if I were the one who made the update or not. Is this the right approach
or there is a much better
> way.
If you run the query as follows (insert your connection object & query text)
...
Dim recordsUpdated as Long
Call myConnection.Execute(myQuery, recordsUpdated, adCmdText)
You can then check the records updated to decide what to do next...
If recordsUpdated=0 Then
' offer user options to reload/overwrite
Else
' sucessful update
End If
HTH,
Chris