Prevent Table Update (1 Viewer)

moke123

AWF VIP
Local time
Today, 15:16
Joined
Jan 11, 2013
Messages
3,910
the form is not unbound.
Remove the recordsource.
remove all the control sources in the controls.
 
Last edited:

June7

AWF VIP
Local time
Today, 11:16
Joined
Mar 9, 2014
Messages
5,465
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, 15:16
Joined
Jan 11, 2013
Messages
3,910
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
Tomorrow, 05:16
Joined
Jun 8, 2019
Messages
179
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, 11:16
Joined
Mar 9, 2014
Messages
5,465
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