Prevent overwrite of existing records in a subform

Gingertrees

Well-known Member
Joined
Sep 21, 2009
Messages
697
(Why hasn't Access fixed this? It's been a problem since the beginning of MS Office!!!)
I'm tracking calls to customers. So I've got a form including customer info (name, address, etc), and a subform within it for recording call data (date, caller, result code [1-10], notes, etc). The top form is successfully locked down, but subform records keep being overwritten. This seems to be because the 1st call record is always on top.

My needs:
When I look up consumer Jane Smith, and she has 23 call records, I want it to show me a new (blank) call record to be added.

DIFFICULTY:
the existing 23 call records need to be able to be browsed, so straight "data entry" mode isn't an option. In rare cases, there may be a mistake that will need to be edited in an old call.

DIFFICULTY 2:
The call subform includes text fields as well as dropdowns (list boxes) and date fields. These should not be editing in the vast majority of cases (EXCEPT for the occasional typing error that needs correction).

Can you help me?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Sounds like a Customer -->CustomerCalls 1 to Many standard form subform set up.
(You haven't said whether or not the same Customer could be called more than once on the same date. I am assuming NO.

tblCustomer
CustomerId autonumber PK
other Customer fields

tblCustomerCalls
CustCallId autonumber PK
CustId Number FK to Customer
CallDate DateTime
other Call to this Customer related info


CustId + CallDate would form a unique composite index to prevent duplicates

It sounds like your subform should have some logic to Add a new record
Click add and it quickly inserts a new Call record for this Customer and adds today's Date. You want to immediately move to this record to add fields.

It sounds that someone can get into the existing record and just overtype whatever is there.

It should be possible to open the CustCalls table as a Snapshop recordset (READ ONLY) by default.
If the Call is really for a new record, click an add button and Open the CustCall recordset as dynaset.

Some combination of these should prevent unintended overwriting of records.
 
Upvote 0
I am assuming you are using LinkMasterFields and LinkChildFields to synchronize the records on your subform.

On the CURRENT event of your mainform, put code to go to a new record on the subform

Code:
   with me.subform_controlname.form
      if not .NewRecord then .AddNew
      .controlname_firstcontrol.SetFocus
   end with
 
Upvote 0
thanks, Jack ;)

oh! there is a mistake ...

Rich (BB code):
   with me.subform_controlname.form
      if not .NewRecord then .Recordset.AddNew
      .controlname_firstcontrol.SetFocus
   end with
 
Last edited:
Upvote 0

Forum statistics

Threads
1,217,361
Messages
6,136,105
Members
449,993
Latest member
Sphere2215

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top