Page 1 of 1

subform adds "blank" new record when marked deletable = no

Posted: Sun Jun 24, 2012 8:36 pm
by anorman
Hello,

I have a clients tables, and a contacts table.

On the clients form, I added a subform containing all the contacts associated with that client.

I do NOT want to be able to delete any contacts for database integrity. So, on the subform I set "deleteable" to NO.

However, I do want to be able to add a contact from this subform, so I set BLANK ROWS = 1.

It appears that anytime I do a save on this form, it adds a blank record to the contacts database with the client ID.

Is this some setting I did wrong, or is there a way around this?

This is on Version 2.7

Thanks,
- Andre

Re: subform adds "blank" new record when marked deletable =

Posted: Mon Jun 25, 2012 1:40 am
by admin
Andre,

Can you show us the sql used in the subform?

Steven

Re: subform adds "blank" new record when marked deletable =

Posted: Mon Jun 25, 2012 5:08 am
by anorman
the SQL statement in the subform is:

Table: contact
Primary Key: cn_id
Foreign Key: cn_cl_id

SELECT * FROM contact WHERE cn_cl_id = '#id#'

Blank rows = 1

If I change DELETEABLE = NO and go into a Client record and save it (say I changed something in the client, not the subform) it will create a new blank record (with the Client ID in the foreign key) in the contact table.

changing DELETEABLE = YES (So the check boxes with the "DELETE" column at the end of the blank row) shows up, the problem does not occur.

Am I doing something wrong, is this a bug, or is this a limitation?

Re: subform adds "blank" new record when marked deletable =

Posted: Mon Jun 25, 2012 11:06 pm
by admin
Andre,

This might be your answer..

http://forums.nubuilder.cloud/viewtopic.p ... nk+subform

Steven