d2tw4all
01-13-2004, 03:26 PM
Hello,
I'm currently querying an SQL database with the following commands:
oConn.Open sConnection
oRs.Open sSQL, oConn
getntusername = oRs("ntaccount")
oRs.Close
oConn.Close
Set oRs = Nothing
Set oConn = Nothing
There is a bunch before and after but this is the gist of it, basically it all works fine if the record exists, but if it finds a record missing it errors out. How can I error trap for this, basically I'm passing a full name at the database and it is returning an NT username, this query is how I'm confirming for valid NT username so if the username doesn't exist I just want to write it to a log. I can handle the log writing part, however I need to be able to trap it if it fails rather than an error. On error resume next results in the program hanging so that isn't an option... Any ideas?
Tom
I'm currently querying an SQL database with the following commands:
oConn.Open sConnection
oRs.Open sSQL, oConn
getntusername = oRs("ntaccount")
oRs.Close
oConn.Close
Set oRs = Nothing
Set oConn = Nothing
There is a bunch before and after but this is the gist of it, basically it all works fine if the record exists, but if it finds a record missing it errors out. How can I error trap for this, basically I'm passing a full name at the database and it is returning an NT username, this query is how I'm confirming for valid NT username so if the username doesn't exist I just want to write it to a log. I can handle the log writing part, however I need to be able to trap it if it fails rather than an error. On error resume next results in the program hanging so that isn't an option... Any ideas?
Tom