The example doesnt use drag and drop which is part of your requirement isnt it?
Without testing I dont see any problems with the code, you say "Men de er aldrig blevet færdigudviklet og virker ikke for mig"
what doesnt work, and what needs to be "færdigudviklet"?
Your obviously going to need code to give sort field a value when creating a new record and also change values when deleting but other than that whats needed?
Jeg har en Form med et Dataark med navnet: Produkt_Dataark UFrm Jeg har 2 knapper på Formen med bl.a navnet: cmdDown I Dataarket har jeg elementet : Prioritet I cmdDown har jeg:
Private Sub cmdDown_Click() MoveSortDown "Prioritet", Me End Sub
Public Sub MoveSortDown(SortField, frm As Access.Form) Dim rsClone As DAO.Recordset Dim lngNewSort As Long Dim lngOldSort As Long Set rsClone = frm.RecordsetClone rsClone.AbsolutePosition = frm.Recordset.AbsolutePosition If Not (IsNull(rsClone.Fields(SortField)) Or rsClone.AbsolutePosition >= rsClone.RecordCount - 1) Then ' <=============Fejl 3265 lngOldSort = rsClone.Fields(SortField) lngNewSort = lngOldSort + 1 rsClone.Edit rsClone.Fields(SortField) = lngNewSort rsClone.Update rsClone.MoveNext rsClone.Edit rsClone.Fields(SortField) = lngOldSort rsClone.Update frm.Requery frm.Recordset.FindFirst SortField & " = " & lngNewSort End If End Sub
Som vist med pilen får jeg fejl 3265 Elementet blev ikke fundet
Referring to your comment "' <== Måske: "Produkt_Struktur_Dataark UFrm" i stedet for Me"
Well your almost correct, because the buttons are on the main form then the code is going to fail, so you need to refer to the sub form instead. And its not the name of the sub form "Produkt_Struktur_Dataark UFrm" but the sub form object the form is contained in which you need refer to. If you click on the edge of the sub form in design view you can see the name of the sub form object in the "Name" property which is in the "Other" tab.
At the moment the sub form object "Name" is the same as the sub form ""Produkt_Struktur_Dataark UFrm", you should also change that to something easier, for example "SubFrm1". Now change the code to
Call moveSortUp("Prioritet", Me.SubFrm1.Form) and Call MoveSortDown("Prioritet", Me.SubFrm1.Form)
:-) Dont forget to solution as answer if it works, so we can close question ;-)
Synes godt om
1 synes godt om dette
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.