Results 1 to 5 of 5
  1. #1
    lixolin is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    6

    Code corrupting form only when filtered (error 3625)

    Hello!



    I am managing a database for projects and tasks and I have encountered a problem with a function i added a few week ago, and after not finding a solution after searching the forums I now seek your help!

    I have a form to show tasks given to our unit as a split form and in this form I added a button that is supposed to duplicate a chosen task. The code looks like
    Code:
    With Me.RecordsetClone
       .AddNew
           !Projekt = Me.Projekt
            !Tilldelad = Me.Tilldelad
            !Status = Me.Status
            !Startdatum = Me.Startdatum
            !Förfallodatum = Me.Förfallodatum
            !Rubrik = Me.Rubrik
            If Not IsNull(Me.Beskrivning) Then
            !Beskrivning = Me.Beskrivning
            End If
            If Not IsNull(Me.Kommentar) Then
            !Kommentar = Me.Kommentar
            End If
            !Prioritet = Me.Prioritet
        .Update
    This function is just to duplicate a single task. It works perfectly whenever the form is not filtered, however; When i apply a filter to the form (example: Show only the tasks from the lates project) it returns error msg 3625 on the line "!Projekt = Me.Projekt" with the motivation that (translated now "The name does not exist". And here's the real kicker! Now when i remove the filter, all information dissappears from the form only to be replaced by the text "#Name?" in every box. If i re-filter the form and remove the filter again without running the code all goes back to normal. Only filtering and de-filtering does not corrupt the form in this way, so i assume that the code is the bad guy here!

    I also assume that the problem has something to do with the fact that the code works in a recordset (whatever that is?) but since i have very (!) little previous experience with programming (i didn't even write this code myself but rather found it online, and i obviously don't know what a recordset is!) but i can't for the life of me figure out what is wrong. I'm fairly aquainted with most other features in Access (im using 2010)!

    Any help in solving this problem will be greatly appreciated!

  2. #2
    lixolin is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    6
    Okay so i solved the problem by rewriting the code to be:

    Code:
    Dim rst as recordset
    set rst = CurrentDB.OpenRecordset("SELECT * FROM Uppgifter")
    
    With rst
         .AddNew
            !Projekt = Me.Projekt
            !Tilldelad = Me.Tildelad
            !Status = Me.Status
    AND SO ON!
    And now it works with and without filters. If someone could explain why the database behaved so erradically the first time i would still very much like to hear it, seems like something you can draw some knowledge and understanding from!

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    1) The RecordsetClone property is Read-Only.
    So you cannot use a RecordsetClone to add records to a dataset (tables).

    2) "The RecordsetClone property setting is a copy of the underlying query or table specified by the form's RecordSource property."
    The bold Red is my emphasis. The RecordsetClone property is a COPY of the form recordset. (See #1 above)

    See:
    http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Then it's still a mystery what was happening when the unfiltered form appeared to work with the RecordsetClone to add new record.

    lixolin, do you still have the source for that code? Can you post link?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I have confirmed, unless something else I can't see is happening, that in spite of what that MS article states, it is possible to use RecordsetClone to add new record. https://www.accessforums.net/program...orm-39738.html

    It even works if the form has a filter on.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Code for search form error
    By jfn15 in forum Forms
    Replies: 4
    Last Post: 06-11-2013, 09:02 AM
  2. Code Error on Form To Disable Shift Key
    By burrina in forum Forms
    Replies: 3
    Last Post: 12-24-2012, 07:27 PM
  3. Replies: 1
    Last Post: 09-08-2012, 05:51 AM
  4. Error in form code
    By devesa in forum Access
    Replies: 3
    Last Post: 05-25-2010, 10:15 AM
  5. Error 3625
    By workingboy456 in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2009, 08:33 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums