Try this:
Private Sub Form_Current()
Me.cmdWissen.Visible = (Me.CurrentRecord < Me.RecordsetClone.RecordCount)
End Sub
Try this:
Private Sub Form_Current()
Me.cmdWissen.Visible = (Me.CurrentRecord < Me.RecordsetClone.RecordCount)
End Sub

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
That does not work.
I have to say, I have also other code on form_current.
I put my new code between it, but still it does not work:
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("qrymaxnrfactuur", dbOpenDynaset)
On Error GoTo form_Err
Me.subFrmFacturatie.Form.AllowEdits = (Me.ynVoldaan = False)
Me.subFrmFacturatie.Form.AllowAdditions = (Me.ynVoldaan = False)
Me.subFrmFacturatie.Form.AllowDeletions = (Me.ynVoldaan = False)
Forms!frmfacturatie!lblLocked = "Deze factuur kan niet bewerkt worden, daar ze reeds voldaan is!"
Forms!frmfacturatie!cmdLocked.Visible = True
If Me.ynVoldaan Then
Forms!frmfacturatie!lblLocked = "Deze factuur kan niet bewerkt worden, daar ze reeds voldaan is!"
Forms!frmfacturatie!cmdLocked.Visible = True
ElseIf rst!factnr > Me.IDfactuur Then
MsgBox rst!maxnr & "-" & Me.IDfactuur
Me.cmdWissen.Visible = False
Else
MsgBox rst!maxnr & "-" & Me.IDfactuur
Forms!frmfacturatie!lblLocked = ""
Forms!frmfacturatie!cmdLocked.Visible = False
End If
rst.Close
Set rst = Nothing
Set db = Nothing
form_End:
Exit Sub
form_Err:
Resume form_End
The message box shows that rst!factnr is bigger than me.idfactuur, so why does it not does the code?
Your code does not work, but I forgot to tell that I have already code there, so I put it between it.
I have put this code and that works:
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("qrymaxnrfactuur", dbOpenDynaset)
On Error GoTo form_Err
Me.subFrmFacturatie.Form.AllowEdits = (Me.ynVoldaan = False)
Me.subFrmFacturatie.Form.AllowAdditions = (Me.ynVoldaan = False)
Me.subFrmFacturatie.Form.AllowDeletions = (Me.ynVoldaan = False)
Forms!frmfacturatie!lblLocked = "Deze factuur kan niet bewerkt worden, daar ze reeds voldaan is!"
Forms!frmfacturatie!cmdLocked.Visible = True
If Me.ynVoldaan Then
Forms!frmfacturatie!lblLocked = "Deze factuur kan niet bewerkt worden, daar ze reeds voldaan is!"
Forms!frmfacturatie!cmdLocked.Visible = True
ElseIf rst!maxnr > Me.IDfactuur Then
Me.cmdWissen.Visible = False
Else
Forms!frmfacturatie!lblLocked = ""
Forms!frmfacturatie!cmdLocked.Visible = False
End If
rst.Close
Set rst = Nothing
Set db = Nothing
form_End:
Exit Sub
form_Err:
Resume form_End
Now it works just fine.
Thanks
Does this work better?
...
ElseIf rst!factnr > Me.IDfactuur Then
MsgBox rst!maxnr & "-" & Me.IDfactuur
Me.cmdWissen.Visible = False
Forms!frmfacturatie!lblLocked = ""
Forms!frmfacturatie!cmdLocked.Visible = False
Else
MsgBox rst!maxnr & "-" & Me.IDfactuur
Me.cmdWissen.Visible = True
Forms!frmfacturatie!lblLocked = ""
Forms!frmfacturatie!cmdLocked.Visible = False
End If
Thanks that's it!
I feel stuppid.
thanks
No need to feel stupid! We all have had to learn! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>