MLH wrote:
I'm wondering if VB receives any event notice
indicating that a confirmation dialog just opened?
That is, can I tell if a confirmation dialog WAS
encountered and then act on it?
Just use the execute method and hadnle errors. If no errors, the
statement was passed.
For example (this air code uses David's dblocal function for the
database variable):
Sub sWhatever()
dim strStage as string 'Stage we're at if error thrown
dim strS as string
on error goto err_proc
'Clear records
strStage = "Deleting Existing Records"
strs = "Delete * from tbl_table"
dblocal.execute strs, dbfailonerror
'Add new records
strStage = "Adding New Records"
strS = "Insert into tbl_table (blah, blah...."
dblocal.execute strs, dbfailonerror
Exit_Proc:
Exit Sub
Err_Proc:
select case err.number
case 13 'type mismatch
msgbox strstage & vbcrlf & vbcrlf & _
"Incorrect data type for field...."
resume exit_proc
case 3022 'PK violation, rejig PK and resume
<code to redo strS>
resume 'Or a msgbox saying stuff related to PK
case else
msgbox "Error " & err.number & " ' & err.description & _
vbcrlf & vbcrlf & "Encountered when " & strStage, _
vbCritical, "Error on Sub Whatever", _
err.helpfile, err.help.context
resume exit_proc
end select
End Sub
--
Tim
http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me