C
cleongatl
This may sound odd, but... I have created a form, which also contains a
subform, that is supposed to allow the user to add new records or edit
existing records. The problem occurs when, after I pull up an existing record
and then try to change the data in one of the main form fields, a NEW record
is created in the underlying table. All the data in the record is copied to
the newly created record, including whatever I also modified. I am trying to
actually edit the existing displayed record, not create a whole new one.
I am using a combo box control called "IDX_Provider_ID", which gets its drop
down values from a query on the underlying table (which I set up in Row
Source property.)Then code autofills the rest of the 10 fields in the main
form via this code, verbatim:
Private Sub IDX_Provider_ID_AfterUpdate()
'Me.Provider_Last_Name.Requery
Me!Provider_Last_Name = Me![IDX_Provider_ID].Column(1)
Me!Provider_Title = Me![IDX_Provider_ID].Column(2)
Me!Provider_First_Name = Me![IDX_Provider_ID].Column(3)
Me!Provider_MI = Me![IDX_Provider_ID].Column(4)
Me!DIVISION_ID = Me![IDX_Provider_ID].Column(5)
Me!START_DATE = Me![IDX_Provider_ID].Column(6)
Me!RECEIVED_FROM_PS = Me![IDX_Provider_ID].Column(7)
Me!SSN = Me![IDX_Provider_ID].Column(8)
Me!DOB = Me![IDX_Provider_ID].Column(9)
Me!INACTIVE_INDICATOR = Me![IDX_Provider_ID].Column(10)
End Sub
The subform, which has its own, separate table as a source, is also linked
to the main form via criteria where a field also called "IDX_Provider_ID"
matches a field in the main form. This is viewed as a a datasheet and the
correct data shows up and if I try to edit any of those fields, the proper
record is updated, and no new record is crated there, unless I go to a new
record by clicking on ">*" button at the bottom of the page.
Furthermore, I based this problematic main form on another form, but that
form does not have this "duplicating records" problem. I compared them with a
fine tooth combed and cannot find out whyI am having the problem.
1. Can anyone offer any help on why the main form is creating a new record
on every single edit I make on any field?
2. How can I get the form and subform to both refresh after so that I get a
blank fields in both, but that do not create a new record unless data is
entered?
Thanks,
-Chris
subform, that is supposed to allow the user to add new records or edit
existing records. The problem occurs when, after I pull up an existing record
and then try to change the data in one of the main form fields, a NEW record
is created in the underlying table. All the data in the record is copied to
the newly created record, including whatever I also modified. I am trying to
actually edit the existing displayed record, not create a whole new one.
I am using a combo box control called "IDX_Provider_ID", which gets its drop
down values from a query on the underlying table (which I set up in Row
Source property.)Then code autofills the rest of the 10 fields in the main
form via this code, verbatim:
Private Sub IDX_Provider_ID_AfterUpdate()
'Me.Provider_Last_Name.Requery
Me!Provider_Last_Name = Me![IDX_Provider_ID].Column(1)
Me!Provider_Title = Me![IDX_Provider_ID].Column(2)
Me!Provider_First_Name = Me![IDX_Provider_ID].Column(3)
Me!Provider_MI = Me![IDX_Provider_ID].Column(4)
Me!DIVISION_ID = Me![IDX_Provider_ID].Column(5)
Me!START_DATE = Me![IDX_Provider_ID].Column(6)
Me!RECEIVED_FROM_PS = Me![IDX_Provider_ID].Column(7)
Me!SSN = Me![IDX_Provider_ID].Column(8)
Me!DOB = Me![IDX_Provider_ID].Column(9)
Me!INACTIVE_INDICATOR = Me![IDX_Provider_ID].Column(10)
End Sub
The subform, which has its own, separate table as a source, is also linked
to the main form via criteria where a field also called "IDX_Provider_ID"
matches a field in the main form. This is viewed as a a datasheet and the
correct data shows up and if I try to edit any of those fields, the proper
record is updated, and no new record is crated there, unless I go to a new
record by clicking on ">*" button at the bottom of the page.
Furthermore, I based this problematic main form on another form, but that
form does not have this "duplicating records" problem. I compared them with a
fine tooth combed and cannot find out whyI am having the problem.
1. Can anyone offer any help on why the main form is creating a new record
on every single edit I make on any field?
2. How can I get the form and subform to both refresh after so that I get a
blank fields in both, but that do not create a new record unless data is
entered?
Thanks,
-Chris