chrisjames25
Registered User.
- Local time
 - Today, 11:44
 
- Joined
 - Dec 1, 2014
 
- Messages
 - 404
 
HI I have an invoice form with a subform. 
THe subform show the products i have sold on the particular invoice. It is displayed as a continuous form. What i am trying to do is be able to delete particular rows from the invoice form by clicking the command button. See image.
From help earlier today i have learnt that a recordset is not best way to do this and i think a delete query would do the job but wanting to check i havnt missed a really easy obvious method. I found following code online but it fails when i run it:
	
	
	
		
It says the command or action deleterecord isnt available now?
Any advice much appreciated
 THe subform show the products i have sold on the particular invoice. It is displayed as a continuous form. What i am trying to do is be able to delete particular rows from the invoice form by clicking the command button. See image.
From help earlier today i have learnt that a recordset is not best way to do this and i think a delete query would do the job but wanting to check i havnt missed a really easy obvious method. I found following code online but it fails when i run it:
		Code:
	
	
	   If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, "Delete Current Record ?") = vbYes Then
        If Me.NewRecord Then
            DoCmd.RunCommand acCmdUndo
          Else
            DoCmd.SetWarnings False
            DoCmd.RunCommand acCmdSelectRecord
            DoCmd.RunCommand acCmdDeleteRecord
            DoCmd.SetWarnings True
        End If
    End If
	It says the command or action deleterecord isnt available now?
Any advice much appreciated