Is it possible to put a total 'Y' in the recordlinenumbering
I have a working functioncode but don't know how to put the total(lines) in it.
Function GetLijnNr(F As Form, SleutelNaam As String, LnStWaarde)
Dim RS As Recordset
Dim CountLines
'Dim maxcount As Integer
On Error GoTo Err_GetLijnNr
Set RS = F.RecordsetClone
' Zoek huidig record.
Select Case RS.Fields(SleutelNaam).Type
' Zoek waardeveldtypesleutel?
Case DB_INTEGER, DB_LONG, DB_CURRENCY, DB_SINGLE, _
DB_DOUBLE, DB_BYTE
RS.FindFirst "[" & SleutelNaam & "] = " & LnStWaarde
' Zoek met datumveldwaardetypesleutel?
Case DB_DATE
RS.FindFirst "[" & SleutelNaam & "] = #" & LnStWaarde & "#"
' Zoek met tekstdatatypesleutel?
Case DB_TEXT
RS.FindFirst "[" & SleutelNaam & "] = '" & LnStWaarde & "'"
Case Else
MsgBox "ERROR: Invalid key field data type!"
Exit Function
End Select
' Loop achteruit, lijnen tellen.
Do Until RS.BOF
--> CountLines = CountLines + 1 ' & " . " & maxcounter
RS.MovePrevious
Loop
Bye_GetLijnNr:
' Resultaat terug geven.
GetLijnNr = CountLines
Exit Function
Err_GetLijnNr:
CountLines = 0
Resume Bye_GetLijnNr
End Function
The control source of a unbound linenr. textbox --> =GetLijnNr([Form];"PrimIDTstblwoningen";[PrimIDTstblwoningen])
I have a working functioncode but don't know how to put the total(lines) in it.
Function GetLijnNr(F As Form, SleutelNaam As String, LnStWaarde)
Dim RS As Recordset
Dim CountLines
'Dim maxcount As Integer
On Error GoTo Err_GetLijnNr
Set RS = F.RecordsetClone
' Zoek huidig record.
Select Case RS.Fields(SleutelNaam).Type
' Zoek waardeveldtypesleutel?
Case DB_INTEGER, DB_LONG, DB_CURRENCY, DB_SINGLE, _
DB_DOUBLE, DB_BYTE
RS.FindFirst "[" & SleutelNaam & "] = " & LnStWaarde
' Zoek met datumveldwaardetypesleutel?
Case DB_DATE
RS.FindFirst "[" & SleutelNaam & "] = #" & LnStWaarde & "#"
' Zoek met tekstdatatypesleutel?
Case DB_TEXT
RS.FindFirst "[" & SleutelNaam & "] = '" & LnStWaarde & "'"
Case Else
MsgBox "ERROR: Invalid key field data type!"
Exit Function
End Select
' Loop achteruit, lijnen tellen.
Do Until RS.BOF
--> CountLines = CountLines + 1 ' & " . " & maxcounter
RS.MovePrevious
Loop
Bye_GetLijnNr:
' Resultaat terug geven.
GetLijnNr = CountLines
Exit Function
Err_GetLijnNr:
CountLines = 0
Resume Bye_GetLijnNr
End Function
The control source of a unbound linenr. textbox --> =GetLijnNr([Form];"PrimIDTstblwoningen";[PrimIDTstblwoningen])