473,396 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Cancel/delete constrained new row created in continuous subform?

A shipment of material is received.
The shipment contains several items.
Each item is assigned an internal tracking number for auditing
purposes and further processed.
The tracking number is mandatory, unique and non-zero, but _cannot_ be
obtained or assigned automatically by Access (due to business rules
[perhaps part of the anti-productivity initiative ;) ]).

Table A is the receive table
Columns: AID, ReceiveDate, CompanyID

Table B is a item tracking number table
Columns: BID, AID, TrackingNumber, ItemTypeID, ItemCount

A frmReceiving shows the fields Date and Company, and has a continuous
subform (linked by AID) for showing/entering the tracking number of
each item of the shipment received.

Suppose the tracking number is _not_ available, but something was
entered for ItemTypeId or Count. At this point the record is
incomplete.
The data entrist has to cancel or delete the 'new item row having a
blank tracking number' and go ferret out the tracking number from the
control department before entering the type and count.

When the records edit pencil icon is right clicked, so as to be "Cut"
from the context menu, this dialog appears:
"The field 'frmReceiving.TrackingNumber' can't contain a null value
because the required property for this field is set to true. Enter a
value in this field."

To prevent spurious data, I don't want a dummy number entered, just so
the record can be deleted!

Q: What would be a good strategy for canceling the 'incomplete' new
item row ?

I would like to have a 'cancel' or 'delete' command icon in the
continuous subform, but only show it if the tracking number is
missing, or if the tracking number entered would fail the unique
constraint.

TIA,
Richard

Feb 1 '07 #1
1 2785
On Feb 1, 11:31 am, "Richard" <richard.goo...@devenezia.comwrote:
A shipment of material is received.
The shipment contains several items.
Each item is assigned an internal tracking number for auditing
purposes and further processed.
The tracking number is mandatory, unique and non-zero, but _cannot_ be
obtained or assigned automatically by Access (due to business rules
[perhaps part of the anti-productivity initiative ;) ]).

Table A is the receive table
Columns: AID, ReceiveDate, CompanyID

Table B is a item tracking number table
Columns: BID, AID, TrackingNumber, ItemTypeID, ItemCount

A frmReceiving shows the fields Date and Company, and has a continuous
subform (linked by AID) for showing/entering the tracking number of
each item of the shipment received.

Suppose the tracking number is _not_ available, but something was
entered for ItemTypeId or Count. At this point the record is
incomplete.
The data entrist has to cancel or delete the 'new item row having a
blank tracking number' and go ferret out the tracking number from the
control department before entering the type and count.

When the records edit pencil icon is right clicked, so as to be "Cut"
from the context menu, this dialog appears:
"The field 'frmReceiving.TrackingNumber' can't contain a null value
because the required property for this field is set to true. Enter a
value in this field."

To prevent spurious data, I don't want a dummy number entered, just so
the record can be deleted!

Q: What would be a good strategy for canceling the 'incomplete' new
item row ?

I would like to have a 'cancel' or 'delete' command icon in the
continuous subform, but only show it if the tracking number is
missing, or if the tracking number entered would fail the unique
constraint.
To force users to enter a tracking number you can check the tracking
number field in the beforeupdate event of your form. If there isn't
one you can cancel (Cancel = True) and give user the option (using a
message box perhaps) of entering something by setting focus back to
the tracking number field or to discard the partial record by using
the Undo method of the form. Alternately you could use the error
event of the form itself to trap for both missing and invalid tracking
number:

Private Sub Form_Error(DataErr As Integer, Response As Integer)

Select Case DataErr
Case 3058
MsgBox "Missing tracking number"
txtProductID.SetFocus
Case 3022
MsgBox "Invalid tracking number"
txtProductID.SetFocus
Case Else
MsgBox "Some other error"
txtProductID.SetFocus
End Select

Response = acDataErrContinue

End Sub

Hope this helps,
Bruce

Feb 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Deano | last post by:
If I create 2 or more records in my subform and I then delete the main record, then all the controls on my subform disappear. Yet if there is only one record in the subform then it gets deleted...
8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
2
by: Simon P | last post by:
Hello group, I'm in desperate need of help. Here goes : I have the following tables : CONTACTS (ContactID, FirstName, LastName, Company, etc.), SHOWS (ShowID, ShowDescription) and SHOWDETAILS...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
1
by: gavo | last post by:
Hello everyone! Using A2K i have a form(a) with a subform(b) and within the subform there is a continuous subform(c). in the subform (b) there is a command button used to call a public...
20
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of...
0
by: ApexData | last post by:
I have a subForm sitting on my MainForm. The subForm is a continuous form and Does Not have its RowSource tied to the main Form. If the subform is tested in isolation, outside the MainForm and I...
2
by: Paul | last post by:
How can you cancel a row insert programmatically? I'm not talking about the Form_BeforeInsert(Cancel As Integer). I have a continuous form. A new row is started. Code for the continuous form...
10
beacon
by: beacon | last post by:
Hi everybody, This is probably going to sound unorthodox, but I have to log records that are deleted...I know, go figure. Anyway, I have a form with a (continuous) subform, and on the subform I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.