Turning off warnings in ADO connection to Access db

BigJimSlade

Registered User.
Local time
Today, 08:44
Joined
Oct 11, 2000
Messages
173
Hi, Big Jim here:

I am attempting to use vba in Excel to make a connection to Access XP. I have established the connection, but I am getting an error while attempting to add a new record to my Access table. Specifically, here is my problem...

1) Excel cell has a value of 4.1234
2) Access table field I am attempting to place the above data into allows only 3 values to the right of the decimal
3) Using ADO AddNew, I get the following automation error on the particular field above: "Scaling of decimal value resulted in data truncation"

I am fine with the truncation of the data, but the error keeps popping up as an automation error, and I cannot seem to make the error go away. Is there any way to dismiss this warning so that the code will continue?

Also, I am appending hundreds of fields using a For Next loop, and I would prefer not to try and cater to each field with a Format function or something of that nature. That is why I was hoping I could merely dismiss the warnings.

Thanks in advance for any help,

Big Jim
 
This will turn of your excel warnings

application.displayalerts = false
 
Thanks chergh,

Unfortunately, it is not an Excel Error. It is an error being passed by the recordset in my ADO connection to Access.

I have "Application.DisplayAlerts = False" in my code already, but it doesn't seem to help.

Thanks again
 
Why not use code to validate the value first and truncate it yourself before sending it.
 
Hi bob!

Thank you, that is what I wound up doing.


varExportValue = Round(varExportValue, rst1.Fields(fld1.Name).NumericScale)

Where:
varExportValue = value going to Access
rst1 = ADO recordset of my Access db
.NumericScale = shows the Scale allowed in the field

Thanks again!

Big Jim
 

Users who are viewing this thread

Back
Top Bottom