My Assistant
![]() ![]() |
|
|
Jan 30 2008, 06:19 PM
Post
#1
|
|
|
UtterAccess Guru Posts: 562 |
Hi,
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
Post
#2
|
|
|
UtterAccess VIP Posts: 4,622 From: North Carolina, USA |
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
Post
#3
|
|
|
UtterAccess Guru Posts: 562 |
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
Post
#4
|
|
|
UtterAccess VIP Posts: 4,622 From: North Carolina, USA |
You're Welcome! (IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif) Good luck with your project!
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th May 2013 - 10:35 PM |