Hello, all, again.
I have a continuous Form with Data entry set to True. Its used to edit existing entries and also add new ones. I added a delete command at each row that works just fine, apart from the last row, as it is the new entry row.
My delete command is this:
I tried changing the visibility of the command button:Private Sub Command22_Click() Dim Answer As Integer Answer = MsgBox("Do you want to delete this Pill?", vbYesNo + vbExclamation + vbDefaultButton2, "Delete Confirmation") If Answer = vbYes Then DoCmd.SetWarnings False DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdDeleteRecord DoCmd.SetWarnings True Forms![EditPills].Form![Text253] = "" Forms![EditPills].Form![Text18] = "" Forms![EditPills].Form![PillsSearchQuery_subform].Requery End If End Sub
But that changes the visibility of all command buttons to false.Private Sub Form_Load() If Me.NewRecord Then Me.Command22.Visible = False End If End Sub
Is there a way to distinguish the data entry row to make the button at that row not visible? Maybe a way to tell it its the last row?
If not, is there a way when executing the delete command to tell it there's no record and not execute it?
Thanks again in advance.



Reply With Quote


