Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2008, 11:31 AM
Registered User
 
Join Date: Apr 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to captainlove
Default Forms/SubForm

I have a form that inserts data into a subform on the same form. When I click the Save button, that has an insert sql statement. The command inserts data into the subform twice.
Here is the code

Private Sub Command15_Click()
On Error GoTo Err_Command15_Click


 txtrevision.SetFocus
 strRevision = txtrevision.Text

txtrevision_date.SetFocus
 txtDate = txtrevision_date.Text

    strSQL = "INSERT INTO tblhistory(revision, QCPid,revision_date) VALUES ('" & strRevision & "' ," & Forms.frmqcplist1.txtQcp & ", '" & txtDate & " ')"

    DoCmd.RunSQL strSQL
  Form_Load



Exit_Command15_Click:
    Exit Sub

Err_Command15_Click:
    MsgBox Err.Description
    Resume Exit_Command15_Click



End Sub


lucasfatoye





Similar Threads
Thread Thread Starter Forum Replies Last Post
subform jeremy1048 Access 0 May 2nd, 2008 09:03 AM
Opening forms from other forms Paulsh Access VBA 1 September 30th, 2004 06:54 PM
Subform Headache GregoryHu Access VBA 0 July 9th, 2004 10:20 AM
Filter Subform B Based on Field in Subform A SerranoG Access VBA 3 June 18th, 2004 12:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.