471,893 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Creating Records with Checkboxes on a form

I am trying to set up a form for doing metals analysis. The way my lab works is someone sends us a batch of samples and wants it tested for certain elements, for example lead and cadmium. We have the capability to test for dozens of different elements, but each batch is different and the customers want them tested for different elements. So what I am trying to do is, once the batch is logged in to the system (I have this part completed), I want to be able to click on checkboxes for the elements that I want to test for, and records be created based off of that. For example, we get a batch of 7 samples and the customer wants them to be tested for lead and cadmium. I would want to check those boxes, and have some sort of code create the records for me which would look like reportno, sampleno, analyte, analyteresult, then onto the next record. I can submit a picture of what I mean if that would help, im sure this is confusing.
Sep 13 '21 #1
3 4654
32,470 Expert Mod 16PB
Hi Zach.

Welcome to Bytes.com.

Not so complicated to understand (unusually) Zach, but sounds a great deal like a request for the work to be done for you.

What I'll do to start you off is to give you an outline of where to start from. From there, if you have specific problems, come back & ask specific questions.

What you're asking for isn't built into Access as standard. It's a perfectly reasonable approach, but requires logic to be coded into the code behind the form, and optimally a database design that supports it.

When you have the information that you require which is common to all the records you need created, as well as having checked the metals you want to populate these records with, then you need code to put that data into the correct format for whatever table you have and add those records - probably sequentially but if using SQL you could manage this in a single batch if you're clever enough with your design - using either VBA or SQL.

A SQL batch could be set up as long as you had a table which contains all the possible metals. Otherwise either VBA or SQL can be used to add the records individually in sequence.

Without knowing anything about your database structure I can go no further at this point - which is good. To get any benefit you need to get your hands dirty and start doing this yourself. We'll help when we need to but signs that you're involved & not simply looking for free work are important at this point.
Sep 13 '21 #2
405 Expert Mod 256MB
The screenshot below includes a number of checkboxes so is fairly similar to what you are describing:

You can add the functionality you want by adding code to the Click event of a checkbox control (or possibly the AfterUpdate event).
For example you could run an INSERT SQL statement to append a new record to a table or an UPDATE statement to alter an existing record
Attached Images
File Type: jpg TTSSettings.jpg (199.5 KB, 111 views)
Sep 14 '21 #3
32,470 Expert Mod 16PB
You can add the functionality you want by adding code to the Click event of a checkbox control (or possibly the AfterUpdate event).
I would strongly favour the latter as it catches changes made which are not effected by use of the mouse.

However, from my reading of the question, the trigger for the addition of the records must come after all have been checked and the operator has then confirmed the action. It isn't mentioned in any detail - just referred to. Easy enough to do, but harder to explain when the item it relates to isn't mentioned in the question. Probably some button that then triggers a batch append of all selected items.
Sep 17 '21 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Iain Miller | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

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.