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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top