Customize SQL Error Messages For ODBC client

  • I have my application splitted into FE/BE. BE is SQL Server 2000 and FE is Microsoft Access 2003.  Tables are linked via ODBC.

    I am using windows authentication method.  I have defined roles with different permission levels for each table and put the users under the specified role.

    Whenever, A DML (insert, update, delete) operation fails, native SQL server message appears in microsoft access (FE client). I want to trap the error number and customize the error message so that it should be more user friendly.

     

    Regards,

  • Where is the DML operation being executed? In VB, from bound forms or from direct access to data objects?

    If it is in VB then you can use standard VB error handling to trap and handle errors. If it is from bound forms there there is an On_Error event that you can use.

    If it is from direct access to data objects then you are out of luck, you will just need to put up with the builtin stuff.

    It would be better to use an ADP rather than an MDB, also using ADO rather than DAO. this means you have access to the ADO.Errors collection which can give you a lot more information about an error that occoured at the SQL end.

  • I am using the following method to connect to SQL server & create table definition:

    Dim db as dao.database, rs as dao.recordset, tbl as dao.tabledef

    strcon="ODBC;Driver={SQL SERVER};SERVER=msrvr;Database;mydb;UID=me;pwd=;TrustedConnection=Yes"

    and I am using mostly bound forms. is it the efficient way when you are connected to ODBC data source? Record saving is also done via the natural behavior of access i.e moving to the next record. So which method of err handling will work ?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply