Skip to content

Instantly share code, notes, and snippets.

@blubbll
Created March 29, 2019 21:09
Show Gist options
  • Save blubbll/78344abe599cc190b1ad8d68505bcca9 to your computer and use it in GitHub Desktop.
Save blubbll/78344abe599cc190b1ad8d68505bcca9 to your computer and use it in GitHub Desktop.
vba stuff
Function goForward()
On Error GoTo fehler
curId = Screen.ActiveForm.idFeld.Value
DoCmd.OpenForm FormName:=Screen.ActiveForm.Name, _
OpenArgs:="Suche bei " & Screen.ActiveForm.Name, _
WhereCondition:="ID = " & curId + 1 ' Hier ist wichtig, dass ID keine Strings hat, sondern der Bedingung als Integer übergeben wird.
lastId = curId
GoTo ende
fehler:
MsgBox "Datensatz nicht vorhanden."
DoCmd.OpenForm FormName:=Screen.ActiveForm.Name, _
OpenArgs:="Suche bei " & Screen.ActiveForm.Name, _
WhereCondition:="ID = " & lastId ' Hier ist wichtig, dass ID keine Strings hat, sondern der Bedingung als Integer übergeben wird.
ende:
End Function
Function goBackward()
curId = Screen.ActiveForm.idFeld.Value
If (IsNull(curId)) Then curId = lastId + 1
If (curId) >= 1 Then
DoCmd.OpenForm FormName:=Screen.ActiveForm.Name, _
OpenArgs:="Suche bei " & Screen.ActiveForm.Name, _
WhereCondition:="ID = " & curId - 1 ' Hier ist wichtig, dass ID keine Strings hat, sondern der Bedingung als Integer übergeben wird.
End If
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment