Can you upload your latest file(s)?
If you haven't done much else you can replace the Geneesmiddelbewerkformulier form module with the one included below and try it:
Code:
Option Compare Database
Option Explicit
Dim boNewRecord As Boolean
Private Sub Form_BeforeUpdate(Cancel As Integer)
If boValidateEntries = False Then
Cancel = True
Me.Geneesmiddel.SetFocus
End If
End Sub
Private Function boValidateEntries() As Boolean
boValidateEntries = True
If IsNull(Me.Geneesmiddel + Me.KNMPNummer + Me.Uiterlijk + Me.Vorm + Me.HoudbaarheidKoertGDS + Me.Ingevoerd_door) = True Then
MsgBox "Niet alle velden zijn ingevuld!"
boValidateEntries = False
Exit Function
End If
End Function
Private Sub Form_BeforeInsert(Cancel As Integer)
'Vlad Jan 8 -2019 - you missed these changes
If IsNull(Me.Ingevoerd_door) Then Me.Ingevoerd_door = DLookup("[Username]", "[usysSettings]") 'vc Dec7, 2018
'Vlad Jan 8 -2019 - you missed these changes
End Sub
Private Sub Form_Close()
DoCmd.OpenForm "FrmHomescreenAdmin"
End Sub
Private Sub Form_Current()
If Me.NewRecord = True Then
boNewRecord = True
Else
boNewRecord = False
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
Me.Geneesmiddel.SetFocus
'Me.Ingevoerd_door = DLookup("[Username]", "[usysSettings]") 'Vlad Jan 8 -2019 - you missed these changes
End Sub
Private Sub Knop179_Click()
If vcEncrypt(InputBoxDK("Please enter your password", "Password needed"), 191878912) = DLookup("[Password]", "usysSettings") Then
Me.Dirty = False
DoCmd.PrintOut acSelection
'DoCmd.RunCommand acCmdSaveRecord
Dim FileName As String
Dim FilePath As String
If boValidateEntries = False Then
Me.Geneesmiddel.SetFocus
Exit Sub
End If
FileName = Me.Geneesmiddel & Me.Id
FilePath = "C:\Users\managergal\Desktop\printscreens\" & FileName & "_" & Format(Date, "DD_MMM_YYYY") & ".pdf"
'Vlad Jan 8 -2019 - you missed these changes
'DoCmd.OutputTo acOutputReport, "rptCurrentGeneesmiddel", acFormatPDF, FilePath, False
'If Me.NewRecord = True Then 'newrecord gets canceled by the Me.dirty=false above
If boNewRecord = True Then
'data entry mode
DoCmd.OutputTo acOutputReport, "rptCurrentGeneesmiddel", acFormatPDF, FilePath, False
DoCmd.OpenReport "rptNewproductchecklist", acNormal 'March 9, 2019
Else
'edit mode
DoCmd.OutputTo acOutputReport, "rptCurrentGeneesmiddel", acFormatPDF, FilePath, False
End If
'Vlad Jan 8 -2019 - you missed these changes
MsgBox "Wijzigingen opgeslagen en versiegeschiedenis geupdate"
DoCmd.Close acForm, Me.Name
Else
MsgBox "Sorry, wrong password, please try again", vbCritical
End If
End Sub