Excel 2007 accessing PivotItem.Visible gives error if the field item value is a DATE

I have VBA code to manipulate the content of a pivot table - essentially it hides all but the first N items in a pivotfield.  Under Excel 2003 the code works fine, as expected irrespective of the data content of the pivot field item.  Under Excel
2007, if the data content is a date, the VBA code generates one of several error conditions.
pivotItems(i).Visible = True
Generates error 1004 - Unable to set the visible property of the pivot class
If pivotItems(i).Visible = True then...
Trying to test the visibility generates error 13 - type mismatch
?pivotItems(i).Visible
Trying to determine the visibility of the pivot item in the VBA immediate window, this generates error 2042
I have an illustrative spreadsheet which permits the code to process two different pivot tables, one using a field containg dates; the other a field containing text.  Under Excel 2003, the code works on both pivot tables.  Under Excel 2007 it works
on the text field table, but fails on the date field table.
I have looked for answers on numerous support forums including answers.microsoft but found not found any answers... only the same or similar unanswered question.

Hi Herbert,
Thank you for your continued interest; please find a revised illustration of the problem here -
http://www.mediafire.com/download.php?zc6ty9ctl1n7yd9
I have made the following changes / additions to the problem illustrator:-
Adopted the use of lists for the data source of the pivot table
Removed reference to '(blank)' as a reserved item not hidden by the VBA code to avoid the possibility of hiding all items
In respect of my original code (MK1), utilised a 'real' item name to be the
reserved item
Added a new (MK2) macro to alter the number of visible items which
hides all but one of the VisibleItems collection
makes the first N items in the collection visible
checks that there are only N items visible (the position of the reserved item
might be greater than N)
The code still executes as expected under 2003, but fails (the same as before) under 2007 when the data type of the PivotItem is date.
The MK1 code fails when testing the current visibility of the Item before trying to set the visibility with:- RTE 1004 Unable to
get the PivotItems property of the PivotField Class
The MK2 code fails when trying to set the visibility with:- RTE 1004 Unable to
set the Visible property of the PivotItem Class as reported above.  Note - given that MK2 avoids trying hide invisible items or unhide visible items, I no longer believe that this error is due to the attempt
to set visibility to current state as seen under Excel 2003. I am deeply confused by this now!
I observe with care the different CLASSES on which these failures are reported even though in each case the operations are on the PivotItem.Visible property - MK1 queries it / MK2 attempts to alter it. 
Just in case you have been wondering where this is going, this spreadsheet has no prupose beyond illustrating the Excel 2003 / 2007 problem being encountered elsewhere when manipulating pivot table items whose value are dates.  The requirement
is to provide a simple user interface to a complex managing reporting spreadsheet consisting of a significant number of pivot tables and charts - altering one cell causes the VBA code to modify the collection of pivot tables to deliver a revised view of the
data.  All works fine for 2003 users of the model, but not 2007 users.  I need one spreadsheet which will work correctly on both 2003 & 2007.
Regards.

Similar Messages

  • Problem accessing iTunes. Getting error message "The iTunes Library Extras.itdb file is on a locked disk"?

    Problem accessing iTunes. Getting error message "The iTunes Library Extras.itdb file is on a locked disk"

    Close iTunes, delete iTunes Library Extras.itdb from your iTunes folder, start iTunes. iTunes should rebuild the file automatically.
    tt2

  • Formatting error in the field COBL-GSBER - FF_5 Upload

    Hi Experts,
    When I upload the bank statement in FF_5, I am getting the following error.
    "Error: (00 298) Formatting error in the field COBL-GSBER ; see next message"
    If I make the field "Businees Area" Optional in Field Status Group of the "Bank Main Accout", then I am not getting the above error and the posting also happens to the "Bank Main Account".
    But if I make "Business Area" Required Entry Field then I get the above error.
    Is there any other method to rectify this problem, i.e can this be resolved even after keeping Business Area as a required field.
    Pl advice.
    Rgds,
    Prasad.

    Hi,
    I hope making Business area optional field is not a wise decision...user may go without inputting the business area in the field which later on will create problem for clearing...
    If required go for activating user exit FEB00001... which will give you the business area...
    try the same with your ABAPer....
    Cheers
    PK

  • Error 1074395241: The template descriptor does not contain data required for rotation-invariant matching.

    Hello all,
    I am using the IMAQ Match Pattern 4 to detect the rotation angle of a template image. However, it shows the error: "Error 1074395241: The template descriptor does not contain data required for rotation-invariant matching." What is the problem exactly? How to solve this? The details are explained below.
    My project is a little bit complicated. Part of the block diagram containing the IMAQ Match Pattern 4 is shown below:
    The source image is a series of frames of images read from an AVI video (I used a for loop to process the images frame by frame). The template image is a selected region of the first frame. So it means, the user selected the object of ineterst in the first frame of the video, and in each of the following frames, we need to find the matched object of interest & determine its rotation angle. When I run the block diagram shown above, it does not have any error. However, it shows the rotation angle as zero no matter what it "really" is. Therefore, I changed the block diagram by adding the parameters, shown below:
    But in this case, when I run it, it shows the error that I have indicated in the subject line.
    If you need more details about my project to identify the problem, please let me know.
    Thanks in advance.
    Solved!
    Go to Solution.

    -Please go through pattern matching example which comes along with labview fiirst
    Go to labview Help>>Find Examples and you can search for example.
    -You have create template with angle range and what type of pattern matching you want use.
    -For this you have to use IMAQ Learn Pattern before using IMAQ Match Pattern 4
    Refer :http://zone.ni.com/reference/en-XX/help/370281U-01/imaqvision/imaq_match_pattern_4/
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • FF_5 - Import Bank Statement, Err: Formatting error in the field COBL-KOSTL

    Hi
    When importing the bank statement I'm getting the error
    Error: (00 298) Formatting error in the field COBL-KOSTL ; see next message
    Why is it doing this? In OKB9 I have the GL Account and the cost center assigned. It is the ne GL that is giving this problem, in the classic GL I do not have this problem.
    Thanks in advance

    Hi
    No, it is not that. For some reason in the new GL it does not seem to determine the cost centers and profit centers as usual.
    For exampl to allocate the Profit Center for Balance Sheet Account I used to use 3KEH in the classic gl but in the New gl we must use FAGL3KEH.
    Now with cost center i'm having the same problem, does not determine the cost center when importing the bank statement.
    Can someone help me.
    Thanks in advance
    Edited by: Louis De Gouveia on Mar 3, 2009 7:07 AM

  • Ff_5 Formatting error in the field COBL-KOSTL

    When automatically posting bankstatements we have several searchstrings in place.
    Most of them post against a bookingrule, but in this case I have a posting on a costcenter as well.
    I created two equal searchstrings, one for the bookingrule and one for the costcenter.
    When executing FF_5 SAP only books in area 1 and not in area 2. The error message states:
    00: 298 Formatting error in the field COBL-KOSTL.
    The costcenter is an active one, it is also in OKB9 linked to the cost account number.
    Profitcenter is default.
    What does this message mean, and how can I find out what I did wrong? I am absolutely sure I have made no typo when entering the costcenter in the mapping area of the searchstring.

    Hi Siermann,
    How are you mapping these two in search string , could you tell me ..?..
    Seems to be that cost center is mandatory field but the field is suppressed in GL.
    Thanks,

  • Word 2007 - Save as Pdf gives error - This file is in use by another application or user

    I have MS Office 2007 Small Business.
    For months I have been using the "Save as PDF/XPS" option to save my word documents as PDF files.
    All of a sudden, when I click on the publish button within the "save as PDF dialog", I get the error:
    "This file is in use by another application or user."
    - I have tried creating a new word document and I still get this error when I try to save-as pdf. 
    - I have tried opening a document that previously was able to be saved-as-a-pdf, and it no longer works either.
    - I have tried saving from other office applications (excel, powerpoint) that also get errors now.
    I have not personally installed any new software that I recall between when this worked and stopped working for me.
    As far as I can tell there have been no updates explicitly for save-as-pdf in office.
    Is anyone else seeing this problem all-of-a-sudden?
    Thanks.
    jlk

    I just encountered this problem while trying to save a pdf from Excel 2007.  I had recently updated to Adobe Reader 9.1.
    I received the same error message you're reporting here when I went to Word 2007 and tried to save a pdf file from it as well. 
    I uninstalled Adobe Reader 9.1. 
    Reinstalled the Office 2007 pdf plug-in
    Successfully created pdf files from word and from Excel (which is what I needed to do in the first place).
    I then reinstalled Adobe Reader 9.1 so I could read the PDF files I had just created in Excel and word.
    I then tried to create pdf files from word and excel.  Error messages are back and I'm unable to create pdf's from word or excel.
    So.. why does Office 2007 pdf plugin not work when Adobe Reader 9.1 is installed?
    Frankly I'm getting tired of uninstalling Adobe Reader 9.1 every time I need to create a pdf file in Word or Excel.
    Bry

  • EXCEL VBA: Inserting rows code returns error "2147417848 The object invoked has disconnected from its clients"

    I was executing the following code in Excel 2013 that is linked to a button I use to add multiple rows in a chosen section of a worksheet
    Sub Add_Rows_dc()
    Sheet53.Unprotect ("xxx")
    X = Range("C1").Value + 1 'Section Counter
    Y = ListSheet.Range("I" & X).Value 'Existing rows counter
    Z = ListSheet.Range("H" & X).Value 'Position counter
    Righe = InputBox("How many rows would you like to add?", , "1")
    If Righe < 1 Then GoTo err ' test for invalid row number
    RigheSheet.Rows(X).Copy
    Rows(Z - 1 & ":" & Righe + Z - 2).Insert Shift:=xlDown
    GoTo Fine
    err:
    Mess = MsgBox("PLEASE INSERT A VALID NUMBER OF ROWS", vbCritical)
    Fine:
    'Formulas update
    Z = ListSheet.Range("H" & X).Value 'Position counter update
    Range("U" & Z - Righe - 2 & ":AF" & Z - 2).FillDown
    Sheet53.Protect "xxx", , , , , True
    End Sub
    From time to time it returns me the error "2147417848 The object invoked has disconnected from its clients" and the debug point out the line
    Rows(Z - 1 & ":" & Righe + Z - 2).Insert Shift:=xlDown
    I cannot find any specific reason due to the fact that the error seems randomic, sometimes the code is perfectly executed, sometimes not.
    I wrote this piece of code in Excel 2010 and never encountered such problem before reusing it in Excel 2013
    Has someone an insight or a suggestion?
    Thank you very much

    Re:  strange error
    Try it this way...
    (might work, might not)
    Sub Add_Rows_dc_R1()
     Dim X As Double
     Dim Y As Double
     Dim Z As Double
     Dim Righe As Variant
     Dim Mess As Long
        Sheet53.Unprotect ("xxx")
        X = Range("C1").Value + 1 'Section Counter
        Y = ListSheet.Range("I" & X).Value 'Existing rows counter
        Z = ListSheet.Range("H" & X).Value 'Position counter
        Righe = InputBox("How many rows would you like to add?", , "1")
        If Righe < 1 Then GoTo errX  ' test for invalid row number
         RigheSheet.Rows(X).Copy
         Rows(Z - 1 & ":" & Righe + Z - 2).Insert Shift:=xlDown
        GoTo Fine  
    Fine:
    'Formulas update
     Z = ListSheet.Range("H" & X).Value 'Position counter update
     Range("U" & Z - Righe - 2 & ":AF" & Z - 2).FillDown
     Sheet53.Protect "xxx", , , , , True
    Exit Sub
    errX:
    Mess = MsgBox("PLEASE INSERT A VALID NUMBER OF ROWS", vbCritical)
    End Sub
    Jim Cone
    Portland, Oregon USA
    free & commercial excel programs (n/a xl2013)
    https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2

  • Export Access table into SP - error on hyperlink fields?

    I'm trying to Export an Access DB into Sharepoint.  There are two hyperlink fields in the master table that seem to be blocking the transfer.  The fields are named XLS and PDF.  The data content of the links look like:  "XLS#m:\aaaa\bbbb\cccc\dddd.xlsx"
    In the Access master table, you'd see XLS which would be a link to
    'm:\aaaa\bbbb\cccc\dddd.xlsxm:\aaaa\bbbb\cccc\dddd.xlsx'
    The actual message in the error log is:
    There was an error copying data to a SharePoint list. URL data 'M:\aaaa\bbbbb\ccccc\ddddd.xlsx XLS' in field 'XLS' could not be sent to the server. The URL may be invalid or longer than 255 characters.
    Is it trying to access the xlsx file itself?   If i remove the hyperlink fields, everything works.  However, what do i need to do to be able to include these two fields?

    Hi,
    According to your description, my understanding is that the Access table cannot be exported to SharePoint with the hyperlink fields.
    The format of the hyperlinks in the hyperlink fields XLS and PDF are invalid in SharePoint, so the error occurred when exporting the table to SharePoint.
    I recommend to share the files linked in the hyperlink field with the users you need and use the following link format in the hyperlink field:
    file://aaaa/bbbb/cccc/dddd.xlsx.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • HT1222 Update to Safari 6.0.2 gives error message "The operation couldn't be completed. (NSURLErrorDomain error -3001.)(102)"

    Every time I try an update I keep getting the error message
    "The operation couldn’t be completed. (NSURLErrorDomain error -3001.)(102)."
    Once I get this error message and try to update again, I get told there are no updates. I have to cancel the first attempted update and close all message windows before it lets me try again, and guess what, same error as above.
    Is anyone else having this problem, or know how to fix it.
    Not sure at the moment if this is an Apple related problem or a problem with my machine, but everything else worked ok, including an earlier update to iPhoto

    Use this link instead:
    http://swcdn.apple.com/content/downloads/53/02/041-8081/2jwp4wjrwygtm4lc608qy4h0 n4a9yyq37g/Safari6.0.2Mountain.pkg

  • HT4436 my massage alway give error with the server try again later help

    someone know how strigh forward reset massage and fix error with the server????
    help

    See http://support.apple.com/kb/TS3970?viewlocale=en_US&locale=en_US - maybe it can help solve your problem.
    Clinton

  • Error in the Work item

    Dear All,
                 I am getting the manager is trying to see the work item. he is getting this error.
    "Message number cannot be read from workflow container". What may be the problem for this. how to resolve this issue.
    Message number cannot be read from workflow container
    com.sap.pcuigp.xssfpm.java.FPMRuntimeException: Message number cannot be read from workflow container.
         at com.sap.pcuigp.xssfpm.java.MessageManager.raiseException(MessageManager.java:111)
         at com.sap.pcui_gp.isr.isrprocessevent.FcISRProcessEvent.raiseWorkflowExceptions(FcISRProcessEvent.java:2064)
         at com.sap.pcui_gp.isr.isrprocessevent.FcISRProcessEvent.callRFCIsrApprovalPreparation(FcISRProcessEvent.java:938)
         at com.sap.pcui_gp.isr.isrprocessevent.FcISRProcessEvent.prepareApprovalWorkflow(FcISRProcessEvent.java:395)
         at com.sap.pcui_gp.isr.isrprocessevent.wdp.InternalFcISRProcessEvent.prepareApprovalWorkflow(InternalFcISRProcessEvent.java:1238)
         at com.sap.pcui_gp.isr.isrprocessevent.FcISRProcessEventInterface.prepareApprovalWorkflow(FcISRProcessEventInterface.java:197)
         at com.sap.pcui_gp.isr.isrprocessevent.wdp.InternalFcISRProcessEventInterface.prepareApprovalWorkflow(InternalFcISRProcessEventInterface.java:433)
         at com.sap.pcui_gp.isr.isrprocessevent.wdp.InternalFcISRProcessEventInterface$External.prepareApprovalWorkflow(InternalFcISRProcessEventInterface.java:601)
         at com.sap.pcui_gp.isr.isrprocessevent.init.VcISRInit.getWorkflowIdAndSetData(VcISRInit.java:277)
         at com.sap.pcui_gp.isr.isrprocessevent.init.VcISRInit.onBeforeOutput(VcISRInit.java:217)
         at com.sap.pcui_gp.isr.isrprocessevent.init.wdp.InternalVcISRInit.onBeforeOutput(InternalVcISRInit.java:181)
         at com.sap.pcui_gp.isr.isrprocessevent.init.VcISRInitInterface.onBeforeOutput(VcISRInitInterface.java:139)
         at com.sap.pcui_gp.isr.isrprocessevent.init.wdp.InternalVcISRInitInterface.onBeforeOutput(InternalVcISRInitInterface.java:136)
         at com.sap.pcui_gp.isr.isrprocessevent.init.wdp.InternalVcISRInitInterface$External.onBeforeOutput(InternalVcISRInitInterface.java:212)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.callOnBeforeOutput(FPMComponent.java:603)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.doProcessEvent(FPMComponent.java:569)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.doEventLoop(FPMComponent.java:438)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.wdDoInit(FPMComponent.java:196)
         at com.sap.pcuigp.xssfpm.wd.wdp.InternalFPMComponent.wdDoInit(InternalFPMComponent.java:110)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:108)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:430)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:362)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:748)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:283)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:733)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:668)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
         at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73)
         at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:860)
         at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.create(AbstractApplicationProxy.java:220)
         at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1246)
         at com.sap.portal.pb.PageBuilder.createPage(PageBuilder.java:354)
    Thanks
    Ram

    This seems to be a portal issue. Please check in the Portal related forum.
    Thanks
    Arghadip

  • Bogus error message: "The field jnlp has an invalid value: https."

    We are running into a variant of an old bug. With a Windows XP client using JRE 1.5.0_05, we get:
    {noformat}Launch File Error: The field <jnlp> has an invalid value: https
    Java 1.4+ is required for HTTPS support{noformat}
    which of course is a strange thing for a 1.5 JRE to be squawking about. We found a Sun bug report 6433293 that reports this behavior as occuring on Solaris but not on Windows. We're seeing it on Windows. The bug report suggests that the error message text is the "wrong message" and may be totally unrelated to the actual problem (although it is triggered by having an https URL in the "href" attribute of the <jnlp> tag).
    Because of our customer environment, upgrading the JRE beyond 1.5.0_05 is NOT an option for us. I googled the message and found one blogpost that suggested the error may be related to the XML encoding (which seems surprising, but they claimed changing the encoding fixed the problem for them). I tried fiddling with the encoding values, but to no avail. Anyone know anything about this bug, and any possible workarounds?

    We finally found the solution to this, so I will follow up for the sake of posterity. Thanks, Andrew, for the pointer to JaNeLa. While it didn't tip us off to this particular problem, it did get us thinking in the right direction: that there was something about the JNLP file, completely unrelated to what the error message was reporting, that was causing the problem. Turns out that the Java 1.5.0_05 WebStart JNLP parser had a bug, such that it was tripped up by a JNLP file containing more than one XML comment in immediate succession. It seems unbelievable, but it was completely reproducible. Our JNLP file began like this:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- here's a valid XML comment -->
    <!-- here's another valid XML comment, but it freaks out JWS 1.5.0_05 -->
    <jnlp spec="1.0+" codebase="https://ourserver/ourApp" href="https://ourserver/ourApp/ourApp.jnlp"/> By accounts, this was patched in 1.5.0_10, and we know that the problem didn't occur in 1.6.0_13. In case anyone else has this problem, that's something to look for. (Note: this isn't the only cause of this erroneous error message. It apparently got printed out when the parser was unhappy about various things. I saw another report that someone had a problem with their "encoding" attribute value on their xml header, and fixing that solved their problem.)

  • Getting error message "the requested item could not be found" when trying to install Firefox on my android.

    I had to uninstall Firefox for Android because I was having problems logging in to sync. I got a support e-mail to uninstall and reinstall because the sync issue had been fixed. I uninstalled the Firefox app and then when I tried to reinstall it I get the error message on my phone "the requested item could not be found." HELP!

    Some supported phones are not displaying Firefox in the Market for some reason. We're still investigating this. You can check if your phone is supported here:
    https://wiki.mozilla.org/Mobile/Platforms/Android
    and then download the app directly from here:
    http://ftp.mozilla.org/pub/mozilla.org/mobile/releases/4.0b3/android-r7/multi/
    (Note: If your phone is from AT&T, you will have to search for instructions on "sideloading" the APK file, since AT&T disables the option to install from non-Market sources.)

  • Not converting anything but get error: "Conversion failed converting varchar value 'X' to data type int"

    I have created the following trigger that fires instead of an UPDATE statement and copies the altered data over to an Audit table before proceeding with the requested UPDATE. After doing so, I wrote a simple UPDATE statement for testing:
    UPDATE Products
    SET ProductCode = 'XYZ 2014', ProductName = 'Special Edition Tamborine', ListPrice = 74.99, DiscountPercent = .5
    WHERE ProductID = 28;
    When I run this, I get the following message:
    Msg 245, Level 16, State 1, Procedure Products_UPDATE, Line 14
    Conversion failed when converting the varchar value 'X' to data type int.
    Here is my trigger:
    IF OBJECT_ID('Products_UPDATE') IS NOT NULL
    DROP TRIGGER Products_UPDATE; -- LINE 14
    GO
    CREATE TRIGGER Products_UPDATE
    ON Products
    INSTEAD OF UPDATE
    AS
    DECLARE @ProductID int, @CategoryID int, @ProductCode varchar, @ProductName varchar,
    @Description varchar, @ListPrice money, @DiscountPercent money, @DateUpdated datetime
    BEGIN
    SELECT @ProductID = ProductID, @CategoryID = CategoryID, @ProductCode = ProductCode,
    @ProductName = ProductName, @Description = Description, @ListPrice = ListPrice,
    @DiscountPercent = DiscountPercent, @DateUpdated = GetDate()
    FROM deleted;
    INSERT INTO ProductsAudit
    VALUES (@ProductCode, @CategoryID, @ProductCode, @ProductName, @ListPrice,
    @DiscountPercent, @DateUpdated);
    SELECT @ProductID = ProductID, @CategoryID = CategoryID, @ProductCode = ProductCode,
    @ProductName = ProductName, @Description = Description, @ListPrice = ListPrice,
    @DiscountPercent = DiscountPercent, @DateUpdated = GetDate()
    FROM inserted;
    UPDATE Products
    SET CategoryID = @CategoryID, ProductCode = @ProductCode,
    ProductName = @ProductName, Description = @Description,
    ListPrice = @ListPrice, DiscountPercent = @DiscountPercent
    WHERE ProductID = (SELECT ProductID FROM inserted)
    END
    I am confused a bit by (1) the location of the error and (2) the reason. I have looked over my defined data types and they all match.
    Could someone offer a second set of eyes on the above and perhaps guide me towards a solution?
    Thank you.

    This is an issue in this trigger. It will work for single record updates alone. Also for your requirement you dont need a INSTEAD OF TRIGGER at all.
    You just need this
    IF OBJECT_ID('Products_UPDATE') IS NOT NULL
    DROP TRIGGER Products_UPDATE;
    GO
    CREATE TRIGGER Products_UPDATE
    ON Products
    AFTER UPDATE
    AS
    BEGIN
    INSERT INTO ProductsAudit
    SELECT ProductID,
    CategoryID,
    ProductCode,
    ProductName,
    ListPrice,
    DiscountPercent,
    GetDate()
    FROM deleted;
    END
    Now, in your original posted code there was a typo ie you repeated the column ProductCode twice
    I think one should be ProductID which is why you got error due to data mismatch (ProductID is int and ProductName is varchar)
    see below modified version of your original code
    IF OBJECT_ID('Products_UPDATE') IS NOT NULL
    DROP TRIGGER Products_UPDATE; -- LINE 14
    GO
    CREATE TRIGGER Products_UPDATE
    ON Products
    INSTEAD OF UPDATE
    AS
    DECLARE @ProductID int, @CategoryID int, @ProductCode varchar, @ProductName varchar,
    @Description varchar, @ListPrice money, @DiscountPercent money, @DateUpdated datetime
    BEGIN
    SELECT @ProductID = ProductID, @CategoryID = CategoryID, @ProductCode = ProductCode,
    @ProductName = ProductName, @Description = Description, @ListPrice = ListPrice,
    @DiscountPercent = DiscountPercent, @DateUpdated = GetDate()
    FROM deleted;
    INSERT INTO ProductsAudit
    VALUES (@ProductID, @CategoryID, @ProductCode, @ProductName, @ListPrice,
    @DiscountPercent, @DateUpdated);
    SELECT @ProductID = ProductID, @CategoryID = CategoryID, @ProductCode = ProductCode,
    @ProductName = ProductName, @Description = Description, @ListPrice = ListPrice,
    @DiscountPercent = DiscountPercent, @DateUpdated = GetDate()
    FROM inserted;
    UPDATE Products
    SET CategoryID = @CategoryID, ProductCode = @ProductCode,
    ProductName = @ProductName, Description = @Description,
    ListPrice = @ListPrice, DiscountPercent = @DiscountPercent
    WHERE ProductID = (SELECT ProductID FROM inserted)
    END
    I would prefer doing it as former way though
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for