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!

Validating a procedure ?

Status
Not open for further replies.

suntsu

Programmer
Aug 26, 2001
72
I need to be able to pass a string value depending on the success of the previous line of code...

There are eight update queries that are run, is there any way that i can check whether they have actually run or not ?

I tried the following but obviously doesn't work

==========================================================
strMsg = " Report on Database Update."

DoCmd.OpenQuery "qrycovmgr_cov_prodstage_job", acViewNormal, acEdit

If DoCmd.OpenQuery = True Then
strMsg = strMsg & "cov_prodstage_job - Successfull" & vbCrLf
Else
strMsg = strMsg & "cov_prodstage_job - Failed" & vbCrLf
End If

=========================================================

Any help appreciated .. :)
 
COGITO you are approaching this in the reverse.

In the general sense (or case), you expect the process to execute w/o error. Where the possability of error needs to be addressed, one generally just includes the standard error handler. In the specific instance where the process includes the execution of data manipluation, the start transaction [rollback] & end transaction events may also be utilized to protect date integrity.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
I agree - for multiple queries on multiple tables, use a transaction so that all can be undione if necessary.

If they are update/delete/insert queries, run them using the Execute method and check the value of RecordsAffected.

dim qry as queryDefs
set qry = Currentdb().querydefs("MyUpdateQuery")

qry.Execute
if qry.recordsaffected >0 then
<success>
else
<failure>
end if

M :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top