Can insert records in subform but cannot delete records in subform (1 Viewer)

runner231

New member
Local time
Today, 12:50
Joined
Jul 11, 2018
Messages
5
I have a subform linked to one mainform

The row source of the subform is base on a table.

The row source of the mainform is base on a query(should be read only query) because sum(), group by clause, join are used in the query.

The common identifier between the table and the query is an ID

Therefore, the link master link fields is ID and link child fields is ID.

The subform is in datasheet view.

I am able to insert new record in the subform, however, I can’t delete the record in the subform. When I insert the new record in the subform, the record was inserted into the table.

I “right click” on each row, then select “Delete Record”. Although the record is “deleted”, the record was still there when I reopened the form. I also checked the table to confirm the record was still in the table. I also tried the Delete key, but the records also can’t be deleted.

Sometimes, the “Delete Record” is greyed out when I “right click” on each row. And sometimes, it is not greyed out.

If I run the subform alone, the record in the subform can be deleted. The record was removed from the table when I checked the table.

May I know what could be the reasons why can’t I delete the record even though I can insert a new record in the subform.

Thank You.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:50
Joined
May 7, 2009
Messages
19,169
few things first.
is this parent/child table or both mainform and subform on same 1 table?
what is the ID of the child (subform), autonumber?
you should link on the parent id (autonumber or any) and there must be a FK field on the
child table that points to the parent ID, and not the child's ID (autonumber).
 

runner231

New member
Local time
Today, 12:50
Joined
Jul 11, 2018
Messages
5
few things first.
is this parent/child table or both mainform and subform on same 1 table?
what is the ID of the child (subform), autonumber?
you should link on the parent id (autonumber or any) and there must be a FK field on the
child table that points to the parent ID, and not the child's ID (autonumber).

Hi,

One is mainform, the other is a subform.
The row source of the mainform is base on read only query. This query extracts various fields from various tables. And one of the fields is ID.

The row source of the subform is base on a table. The common identifier(“key”) between the read-only query and this table is ID. ID in table is not autonumber.
 

JHB

Have been here a while
Local time
Today, 20:50
Joined
Jun 17, 2012
Messages
7,732
..
I “right click” at “*” of each row, then select “Delete Record”.
Normally at star is only shown at a new record, so does it show a star at each record?
Could you post a printscreen, or the whole database, (zip it).
 

runner231

New member
Local time
Today, 12:50
Joined
Jul 11, 2018
Messages
5
Normally at star is only shown at a new record, so does it show a star at each record?
Could you post a printscreen, or the whole database, (zip it).

My apology. I should say I right click on each row. There is no *.
 

JHB

Have been here a while
Local time
Today, 20:50
Joined
Jun 17, 2012
Messages
7,732
Do you've any code running in the main- or subform?
Post your database with some sample data, zip it because you haven't post 10 post yet + name of the form in which you've the problem.
Just for clearness, it is a form isn't it, (I ask because you've posted it under Reports)?
 

Users who are viewing this thread

Top Bottom