I have tried removing the ID field from Vonstcategorieën, but I now get a whole lot of new errors which I do not know how to fix. Once I want to open my split finds I get this error:
Code:
Private Sub Knop78_Click()
Dim lngSelectie As Long 'onthoudt welk record momenteel geselecteerd is
Dim lngCategorie As Long 'onthoudt de geselecteerde materiaal categorie
'Bepaal het huidige geselecteerde record uit het subform
lngSelectie = Me.Subformulier_Splitsvondst.Form.CurrentRecord
If lngSelectie > 0 Then 'als er een selectie is
With Me.Subformulier_Splitsvondst.Form.RecordsetClone 'vind de geselecteerde materiaalcategorie
.MoveFirst 'zoek vanaf het begin
.Move lngSelectie - 1 'we zitten nu op 1, dus ga selectie - 1 vooruit
lngCategorie = .Fields(1) Type mismatch
.Close 'sluit de tabel weer netjes
End With
If lngCategorie > 0 Then 'als de materiaalcategorie gevonden kon worden
DoCmd.OpenForm "Splitsvondst", acNormal, , "(vondstnummer = " & CStr(Me.vondstnummer) & ") AND (categorie = " & CStr(lngCategorie) & ")" 'open het formulier
End If
End If
End Sub
I only need it to print one tiny little report and now I need to rearrange my whole database to make it work? In my old database I had the exact same code and it did work. Is there any other way around this?