Question : Handling Access Null value message when running against Oracle table

I'm running using ODBC against an Oracle table with fields declared as:

RES_CAT_NAME VARCHAR2(50) not null
RES_CAT VARCHAR2(10) not null [and this is also declared as a primary key]

If the user removes the pre-existing values from these fields or replaces it with spaces, Access comes back with 'You tried to assign a null value to a variable that is not a variant data type'. Accurate... yes. Easy on the user... no!

I'm not very familiar with Oracle and don't want to tamper with the table unless I really have to, but I can't trap the warning in Access. I've tried using the field's Before Update, Lost Focus, Exit, etc events and set Docmd.SetWarnings false at various points, but the warning breaks right through. Any thoughts on how I kill this warning and/or get a trappable error?

Answer : Handling Access Null value message when running against Oracle table

So now you are faced with how to work around the limitations of the ODBC driver.  As I mentioned above I worked around the issue by switching to pass-through queries but I am not writing data back to the Oracle tables.  I guess one could experiment with changing the order of the fields in the Oracle table to see if the ODBC driver would then assign the PK to the correct field.  If so, the original problem would not be present.  You could utilize pass-through queries to populate a local Access table/recordset, manipulate the data locally and then create update and append processes to write the data back to the Oracle table.

OM Gang
Random Solutions  
 
programming4us programming4us