delete subform record

J

Jim Franklin

Hi, can anyone tell me the best way to delete the current record in a
subform, using a command button on a mainform?

I know this should be easy, but...

Thanks,
Jim F.
 
W

Wayne Gillespie

Hi, can anyone tell me the best way to delete the current record in a
subform, using a command button on a mainform?

I know this should be easy, but...

Thanks,
Jim F.

I use SQL to dlete the record directly from the table and then requery the
subform -

Dim strSQL as String
Dim vMyID as Variant (change this to string. long etc to suit your data)

vMyID = Me.frmMySubForm.Form!MyIDField
strSQL = "DELETE * FROM tblMyTable WHERE ((MyIDField)=" & vMyID & ");"
CurrentDB.Execute strSQL, dbFailOnError
Me.frmMySubForm.Form.Requery


Wayne Gillespie
Gosford NSW Australia
 
Top