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!