By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.

deleteting a record

lee123
100+
P: 556
is there a code or away to delete a record from a subform with a button on a form if so how would that be done

lee123
Feb 9 '08 #1
Share this Question
Share on Google+
1 Reply


puppydogbuddy
Expert 100+
P: 1,923
is there a code or away to delete a record from a subform with a button on a form if so how would that be done

lee123
Lee,
The basic delete code is shown below, You can add message boxes and confirmations as needed. Be sure you replace the illustrative object names I used with the actual object names from your application.
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnDelete_Click()
  2.  
  3. Dim strSQL As String
  4.  
  5. strSQL = "Delete * from YourTable where YourField = " & Me.YourSubformControl.Form.textbox & ";"
  6.  
  7. CurrentDb.Execute strSQL, dbFailOnError
  8.  
  9. End Sub
Feb 9 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.