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
DoCmd.Maximize
' 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??
|