Prevent Table Update (1 Viewer)

moke123

AWF VIP
Local time
Today, 06:53
Joined
Jan 11, 2013
Messages
1,843
the form is not unbound.
Remove the recordsource.
remove all the control sources in the controls.
 
Last edited:

June7

AWF VIP
Local time
Today, 02:53
Joined
Mar 9, 2014
Messages
3,362
Form is bound as are checkboxes. As soon as checkbox is clicked, edit mode is entered for new record and an Autonumber is generated. If you activate form RecordSelectors property you will see this. Record is committed when form closes. I pressed ESC after clicking checkbox then closed form and no record is created.

Unbind checkboxes. The RecordSource will be ignored if all controls are unbound. However, since there is a RecordSource, don't really need code opening recordset. Just move to NewRecord row and populate fields (since DataEntry property is set to Yes, form opens to new record row).
Code:
With Me
    !DateAdded = .DateAdded
    !StockItem = .StockItem
    !GrpId = .GrpId
    !Grp = .Grp
    !SuGrpId = .SubGrpId
    !SubGrp = .SubGrp
    !Supplier = .Supplier
    !SupplierId = .SupplierId
    !Price = .Price
    !Quantity = .Quantity
    !UnitCost = .UnitCost
    !SalePrice = .SalePrice
    !Margin = .Margin
    !InventoryItem = .MinStockSelect
    !GSTApplicable = .GSTApplicable
    !Active = .Active
End With
Adding record to tblInvMins is different matter - use recordset or INSERT action SQL.

I give controls name different from field to reduce confusion, such as tbxQuantity, chkActive, etc.

Setting controls to empty string will also be an issue because code checks for Null. Empty string is not same as Null.

Turns out DefaultValue property is irrelevant. But why use 1 as default value for Yes/No field checkbox? Yes/No field holds 0 or -1.
 
Last edited:

moke123

AWF VIP
Local time
Today, 06:53
Joined
Jan 11, 2013
Messages
1,843
The form is definitely not bound and there are no sub forms.

Lets go back to this answer ...

Just kidding it happens to us all :D
 

Drand

Registered User.
Local time
Today, 22:53
Joined
Jun 8, 2019
Messages
65
Thank you so much folks for your assistance and patience. A rookie mistake I know but I guess this is how you learn. You have been great!
 

June7

AWF VIP
Local time
Today, 02:53
Joined
Mar 9, 2014
Messages
3,362
I did a bunch of edits to prior post, probably after you read it. Might review again.
 

Users who are viewing this thread

Top Bottom