473,218 Members | 1,510 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,218 software developers and data experts.

Need to only run a module if the checkbox is checked

9 Byte
Sorry for lack of details, this is very new to me.

I have a large dataset. There is a table that has a column with the checkbox option. The table is created in the module's code. Some options in the table are selected with the checkbox and some are not. I want the records that are selected (checked) to be processed. My module runs on all the data in the set, but I want it to only run for the sets with the boxes checked. The key is figuring out how to filter the data so that only records with the check box checked for their area will be processed. The module is complex and I need to figure out how to filter what is processed.

Jul 8 '21 #1
8 5729
451 Expert Mod 256MB
Welcome to the forum.
Whilst I'm sure that all makes sense to you, its not clear exactly what you are asking.
The BuildExhibit module may well be complex but apart from its name we know nothing about it.

Assuming you are referring to a field called Included then set a filter in your code/query for Included =True
Jul 8 '21 #2
32,554 Expert Mod 16PB
"Records that are included", "all the data", "the included box", "their area". All of these use real words yet none of them is explained in the context of your work or situation. IE. They're meaningless to anyone but you.

Please try to rewrite your question so it means something to the reader. That way we have a chance of helping you - and that's what we're here for and want to do.
Jul 8 '21 #3
9 Byte
Thank you, I added more details. I have ever coded before and have been given a rather large project.
Jul 9 '21 #4
32,554 Expert Mod 16PB
Hi Brittaff.

That makes a little more sense. It's a bit garbled still to be fair but some of it's clearer at least and we do understand that knowing what to include is something you understand better with experience.

Now, I have to assume that somewhere in your code you open a Recordset object that's based on the table where the data is that you've described. This may be done passing a QueryDef object name or some SQL. Either way, to get a filtered set you'd need to include filtering. If you're using a QueryDef (Saved Query Object) then you need to ensure the QueryDef includes the Field which has a CheckBox and either True or <>False in the Criteria part. On the other hand if it's a SQL string then it must include a WHERE clause that specifies that Field not being False.

I hope this makes sense. We're still working in a large vacuum here as the items we need to talk about still don't have names. It's never as easy to understand what people are trying to tell you when the names aren't available.

If you're still struggling then I suggest you identify, and post for us, the line in your code where the Recordset that the code processes is opened. That will be very helpful as it has to include the names of the relevant objects. Names we need as much as VBA does in order to understand what you want.
Jul 9 '21 #5
9 Byte
Here is the first area where the RecordSet function is used:

'Add "Statement" Line Numbers to table. (line numbers are not correct for Reinsurance Ceded line).
strSQL = ""
strSQL = strSQL & " SELECT Min(tblExhibitsTemplate.ID) AS FirstID, CoSort, AcSort, Ex5Sort"
strSQL = strSQL & " FROM tblExhibitsTemplate"
strSQL = strSQL & " GROUP BY CoSort, AcSort, Ex5Sort"
strSQL = strSQL & " ORDER BY CoSort, AcSort, Ex5Sort;"
Dim rsFirstId As Recordset
Set rsFirstId = MakeRecordSet(strSQL)
With rsFirstId
strSQL = ""
strSQL = strSQL & " UPDATE tblExhibitsTemplate "
strSQL = strSQL & " SET LineNumber = Mid(Str(10000000+[Ex5Sort]*100000+([ID]- " & Str(!FirstId) & " +1)),3,7)"
strSQL = strSQL & " WHERE (CoSort=" & Str(!CoSort) & ")"
strSQL = strSQL & " AND (AcSort=" & Str(!AcSort) & ")"
strSQL = strSQL & " AND (Ex5Sort)=" & Str(!Ex5Sort) & ""
strSQL = strSQL & " ;"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Loop Until .EOF
End With
Set rsFirstId = Nothing
Jul 9 '21 #6
32,554 Expert Mod 16PB
Hi Britaff.

I'm not ignoring this, nor have I disappeared (except for the weekend where I was away at a wedding) so just to let you know I'll look at this again soon.

Jul 12 '21 #7
9 Byte
Thanks Ade,

I have set up a query that runs through the table with the checkboxes and only prints a table with the items checked. My next step is to run another prewritten module for the table that was created from the query.
Jul 14 '21 #8
32,554 Expert Mod 16PB
I'm sorry I got distracted from this. Where are we now? Does your last comment mean you understand now & don't need help?
Aug 9 '21 #9

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

Similar topics

by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! How do I convert a CheckBox.Checked to an int? Regards Martin Arvidsson
by: Michael Champagne | last post by:
We have an application to where you can select/deselect all checkboxes in a checkbox array by clicking a 'master' checkbox at the top of the screen. This seems to work fine unless there is only...
by: AFN | last post by:
I want to click a checkbox and have a 4 line (approx) paragraph appear beneath the checkbox, pushing the rest of the page down. And when unchecking the checkbox, the paragraph should disappear...
by: Andrew | last post by:
Hi, I have a problem capturing the checkboxes that are checked, I get false irrespective of wether they are checked or not. I have gone thru the sample code on this forum, but they dun seem to...
by: nologo | last post by:
All, Have a problem i just cant find the answer for. I'm trying to populate a colum in a SQL database. Basically the column requires a 1 or 0. I'm trying to populate this col via a c#...
by: poolboi | last post by:
hey guys, I've stored password in mysql using SHA1 encryption do i need the module digest::SHA1 when i'm verifying password for user put in?
by: srikanthia | last post by:
hi, im srikanth, i having a datagrid in that i have 5 checkboxes in windows application(C#.net) i want to check only one checkbox at a time and remaining should not be selected regards,...
by: neosp17 | last post by:
HI, I have sub form with checkbox as one checkbox column , name, total amount owned. Only one record from the sub form can be ticked (checked) Question: how to make only one checkbox ticked in sub...
by: Princess Zai | last post by:
how can i select only one checkbox from looped checkboxes in a form and get the value of the textbox corresponds to it. Example is I have an ID and a username, i will add a username, the ID is...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.