Z
zippy
Below is some code for doing and insert into one of my tables. The
inserts do not work because a duplicate key exists, which I want to
happen. The problem is, I cannot get access to return an error for this
condition.
What can I do to get access to return an error on my query, am I doing
something wrong? I am fairly new to vba.
If I create thje sql statement faulty I will get an error, the problem
is that access is not returning an error on good code but failure to
insert because of duplicate keys. Do not know how to get those errors.
Thanks
-------------------------------
CODE
-------------------------------
On Error GoTo sql_error_err
Set Mydb = CurrentDb
Mydb.Execute sql, dbFailOnError
sql_error_exit:
Exit Sub
sql_error_err:
MsgBox Err.Number
MsgBox Err.Description
Debug.Print Err.Description
Debug.Print Err.Description
Debug.Print Err.Source
Resume sql_error_exit
--
Scott Baust
EZDataLink
3200 NE 14th Street Ste 200
Pompano Beach, FL 33062
954-781-9211
inserts do not work because a duplicate key exists, which I want to
happen. The problem is, I cannot get access to return an error for this
condition.
What can I do to get access to return an error on my query, am I doing
something wrong? I am fairly new to vba.
If I create thje sql statement faulty I will get an error, the problem
is that access is not returning an error on good code but failure to
insert because of duplicate keys. Do not know how to get those errors.
Thanks
-------------------------------
CODE
-------------------------------
On Error GoTo sql_error_err
Set Mydb = CurrentDb
Mydb.Execute sql, dbFailOnError
sql_error_exit:
Exit Sub
sql_error_err:
MsgBox Err.Number
MsgBox Err.Description
Debug.Print Err.Description
Debug.Print Err.Description
Debug.Print Err.Source
Resume sql_error_exit
--
Scott Baust
EZDataLink
3200 NE 14th Street Ste 200
Pompano Beach, FL 33062
954-781-9211