Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
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 4th, 2008, 03:02 PM
Authorized User
Join Date: Jan 2006
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default Event Procedure malfunction - duplicating records

I'm using a form to input our work orders into. when the form loads i'm using this procedure and i have a query set as my record source:

DoCmd.OpenForm "F_WorkOrder", acNormal, "", "", , acNormal
    ' Sets the Combo Box to a new record on the WorkOrder Form
    DoCmd.GoToRecord acForm, "F_WorkOrder", acNewRec

so i can either enter in a new client name or select an existing client name to add to my work order. after you are all finished entering all the information on the form i have another procedure to save the information into the work order table: (this is just a small clip of the code to explain what i'm doing)

stSQL = "INSERT INTO T_WorkOrder(ClientID,.....
    Set rs = New ADODB.Recordset
    rs.Open stSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    DoCmd.Close acForm, "F_WorkOrder", acSaveNo

the problem i have run into is that when i run this procedure its creating 2 new records into my work order table one with only the ClientID that i have chosen in my combo box and none of the information on the form and the other record is with the ClientID and all the information i have entered into the fields on my form. i dont understand why its creating the one record with just the ClientID only and none of the information. how do i stop this from happening? otherwise this form is been working GREAT!!! and the weird thing is last month it was working fine and now it started doing this. can anyone help me with this problem??

Similar Threads
Thread Thread Starter Forum Replies Last Post
Choosing the correct Event Procedure ru1 Access 3 October 31st, 2006 04:30 PM
Form Event Procedure Help dbartelt Access 2 June 7th, 2005 04:10 PM
Event Procedure help dbartelt Access VBA 3 May 20th, 2005 05:36 PM
Event Procedure help dbartelt Access 2 May 19th, 2005 03:35 AM
Code Malfunction TonyG Access VBA 2 August 23rd, 2004 12:18 AM

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