Jan 30 2008, 06:19 PM
I have an application that needs some new feature. In one of the feature, I am using access form to update the main table. At the same time, a audit trail table records the details of this update. The audit trail function gives the output as following:
INSERT INTO tblAudit (AuditTrailID, FieldChanged, FieldChangedFrom, FieldChangedTo, User, DateofHit ) SELECT 706-0818-00-00-1 , 'QuoteStatus', '0', '-1', 'USPAVSR', '1/30/2008 5:04:12 PM'
The tblAudit is in Access while the main table is in sql server. The AuditrailID is a text field. After the insert takes place in the audit table the audit table shows different value.
The above row value changes to:
-113 QuoteStatus 0 -1 USPAVSR 1/30/2008 5:04:12 PM
I have no idea where the -113 is coming instead of 706-0818-00-00-1
Any help is highly appreciated. Thanks.
Jan 30 2008, 06:28 PM
INSERT INTO tblAudit (AuditTrailID, FieldChanged, FieldChangedFrom, FieldChangedTo, User, DateofHit ) SELECT '706-0818-00-00-1' , 'QuoteStatus', '0', '-1', 'USPAVSR', '1/30/2008 5:04:12 PM'
You need apostrophes around the value in the SQL statement for a Text field. Without them, it is evaluated as a formula before it is saved (706-0818-00-00-1 = -113). Curious why you are hard coding this value...
Jan 30 2008, 06:36 PM
Thanks for the help fdc. I appreciate it. Actually I am not hardcoding the value. The insert expression has been extracted from the immediate window and then trying to use it to see what values get inserted in the table. I guess I need to change the code to get an output with the quotes against the AuditTrailField. Thanks again.
Jan 30 2008, 07:13 PM
Good luck with your project!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here