Using Checkboxes To Select Multiple Fields In An Iif Query

Dec 1, 2005

Hi all,


Firstly, I'm an ex-fulltime access developer who has found himself doing access work again 6 years later; I can't actually believe how much I've forgotten :s

Anyway, I've done a search and havn't found anything that can help me so wondered if anyone could give some advice.

I have an access form with 3 combo boxes and a checkbox next to each of them. these are accessed using a query with 3 iif statements in it stating; (iif checkbox is null, "*", combo_box_value). the whole query looks like this

SELECT Customers.*
FROM Customers
WHERE (((Customers.Partner)=IIf(Forms!frm_rpt_main!check _partner Is Null,"*",Forms!frm_rpt_main!partner)) AND ((Customers.[Type Business])=IIf(Forms!frm_rpt_main!check_type Is Null,"*",Forms!frm_rpt_main!type)) AND ((Customers.[Year End Month])=IIf(Forms!frm_rpt_main!check_month Is Null,"*",Forms!frm_rpt_main!month)));

However, the query only seems to want to pull data from all 3 combo boxes

My issue is that if a checkbox is not ticked, I want the values to be ignored for all 3 combo's.

I've attached a copy of the mdb file as my description probably doesnt make any sense, the specific query is "qry_select_month_partner_type_wname_frm_rpt"


Thanking you all in advance for your help!

Younger

View Replies


ADVERTISEMENT

Queries :: Allowing Users To Select Multiple Table Fields As Query Criteria

Apr 22, 2013

I am fairly new to Access and I would like to create a form to allow users to create their own query. I would like to allow users to select multiple fields (perhaps with checkboxes?) from all possible fields in a table to return either all data from that field or narrow their search by inputting certain criteria or choosing from a drop down into a text box. Is this possible in Access and any detailed specifics on how to achieve this?

View 3 Replies View Related

Query Filter With Multiple Checkboxes

Mar 19, 2008

Hi Folks.

I have a select query that has 10 columns which are checkboxes (yes/no) from the original table. I can apply filters for individual columns but I want the query to show records with ANY of the boxes checked and only omit those with NO boxes checked.

I have spent the whole atfernoon researching the forum but I can't find what I need. Help much apreciated.

Chalkie.

View 1 Replies View Related

Modules & VBA :: SQL - Select Multiple Fields From Multiple Unrelated Tables

Oct 28, 2013

A small issue I was wondering of for a few day . Is it possible in SQL query to SELECT multiple fields from multiple tables ? Example for the question is

Code:

dim my_var as String
my_var = "SELECT Emp_FName , Emp_LName , Emp_Adress " _
& " FROM Table1 " _
& " AND Emp_Date_Of_Payment , Emp_Sum_Of_Payment " _
& "FROM Table2 " _
& " WHERE Emp_ID = 3 "

Is this code actually valid in SQL gramatics , and is it usable if passed to a Recordset variable ( rs = CurrentDB.OpenRecordset(my_var) ) ? Just FYI - The two tables are not related and I want to keep them that way (If possible relate their records just via SQL/Vba )

View 7 Replies View Related

Multiple Checkboxes To Update Table

Aug 30, 2005

hi, i've a form with 2 combo boxes (month and year) and 2 buttons "save" and "get". I'm trying to figure out how to use that button to perform 4 tasks.

task 1:

when i select the month and the year from the combo boxes and i click the button "get", the form should populate the number of checkboxes equavalent to the number of days of that month. e.g: if i select feb 2008, i should have 29 checkboxes (due to leap year) or i select apr 2005, i should have 30 checkboxes.

assuming that i've done the date validation function.. like jan, mar, may, jul, aug, oct and dec should return 31 days, leap year etc.

task 2:

then how should i assign the date value to the checkbox? say if i check on the 5 th box, it should return me a value of 05/09/2005 (assuming i select sept in my month combo box and 2005 in my year combo box earlier on)

task 3:

how should i code the label for my checkboxes? i wan to have 2 labels on top of the checkbox. the first label to show the name of the day (e.g: mon, tue etc) and the second label to show the day (e.g: 1, 2, 3)

task 4:

not sure if this task is a tall order.. but nonetheless, i need to consult the experts here. let's say when i check multiple checkboxes at one go, how to update into the table i want?

e,g: i check 9 boxes (e.g: 01/09/05, 03/09/2005, 04/09/2005... 23/09/2005) then when i click the button "save", i should have nine records in my table designated to save the data.

pls help. thanks. :)

View 11 Replies View Related

Forms :: Clearing Multiple Checkboxes?

Dec 12, 2013

I have a form register with student names and three columns with checkboxes showing whether they were present, absent or late. The form runs an append query that records the data into a historical table, however on submission the checkboxes remain ticked. way to clear the checkboxes once the data has been submitted?

View 13 Replies View Related

Modules & VBA :: Filtering Using Multiple Checkboxes?

May 2, 2014

I'm having a rough time finding information regarding filtering using multiple check boxes that are not part of an option group. I have 4 "sets" of check boxes that can each have multiple selections made.

For example I have:

12 check boxes for each month
6 check boxes for a selection of years
6 check boxes for order types
5 check boxes for order company

I have written code that successfully creates a string depending on what boxes are checked that looks like this.

[Ship month] = "1" OR [Ship month] = "2" OR [Ship month] = "5" AND [Ship Year] = "2013" OR [Ship Year] = "2014" AND [OrderType] = "SO" OR [OrderType] = "SM" AND [Order Company] = "10430" OR [Order Company] = "10440"

The problem is that it does not filter correctly. After playing around with it I found that as long as the entire is using all AND operators or all OR operaters it works fine, but as soon as I mix them it doesn't work.

View 4 Replies View Related

Select Fields For Query

Sep 15, 2006

I've made a form with list boxes on, the user's selections from which are taken as parameters for a query, created by VBA code.

I want to add a final list box to the form from which the user can select which of the available fields they want to see in the query output (i.e. has the same effect as checking/unchecking the "Show" checkbox for each field on the standard query design grid).

I have written the following code to try and do this, but it isn't working. I'm very new to VBA and wonder if anyone can help me out by showing me what's wrong?


'Build Field List
If Me!lstFieldList.ItemsSelected.Count > 0 Then
For Each varItem In Me!lstFieldList.ItemsSelected
strFieldList = strFieldList & "[" & Me!lstFieldList.ItemData(varItem) & "], "
Next varItem
strFieldList = Left(strCriteria, Len(strCriteria) - 2)
Else
strFieldList = "'*'"
End If

'Create Query String
strSQL = "SELECT Centres." & strFieldList & " " & FROM Centres " & _
"Where " & strCriteria & _
" And " & strCriteriaCtr & strSortOrder & ";"


Running the above gives an error, and the section under "'Create Query String" is highlighted in debug mode so I guess the error must lie there? Either that, or the earlier part where strFieldList is being create is generating something which strSQL cannot interpret.

Many thanks in advance if you can help me.

Gary

View 12 Replies View Related

Creating A Form With Multiple Checkboxes (one For Each Record)

Apr 10, 2005

I have a form. In that form I want to display a series of dates from a database table..ex. 12/15/2004, 12/16/2005, etc... Next to those dates I want to have a checkbox. The user should be able to click on that checkbox if they want to sign up for that date. So there could be more then 1 checkbox checked, but there will always be atleast 1. So my first question is, how do I make this work. I've tried several things and everytime I check on the checkbox it checks all of the checkboxes.


PLEASE HELP!


Subject 2: Regarding the above question, how do i reference those dates that I've checked the checkbox next to, to put into another table?


PLEASE HELP!

View 1 Replies View Related

Forms :: Multiple Checkboxes To Filter Report

May 7, 2015

I have a form where you can select four different options: Health, Dental, Vision, and COBRA, with a button to run a census. Right now, the button runs a DoCMD.OpenReport to open a report named "Census" where there are four text boxes, "Health Coverage Type" "Dental Coverage Type" "Vision Coverage Type" and "COBRA Coverage Type". I want the user to be able to select a checkbox, then filter the report to only enable the text boxes of the corresponding names.

So if someone selects Health & Dental, I want the report to run with the "Health Coverage Type" and "Dental Coverage Type" textboxes enabled/visible, but the other two to be blank.

View 1 Replies View Related

Modules & VBA :: Concatenating Data From Multiple Checkboxes

Apr 15, 2015

I have 8 checkboxes. Each checkbox has several e-mail addresses as string. Therefore, each checkbox has a string variable declared. I was wondering what should I do when selecting multiple check boxes. This is my code:

Code:
If Me!chkAGDLLA = True Then
Forms!email.lstName = Null
Forms!email.chkComercial = False
Forms!email.chkOperacional = False
strAGDLLA = "email1, email2, email3, email4"
strMail = strAGDLLA & ", " & strISA & ", " & strMAYA & ", " & strSANGER & "," & strSANSE & ", " & strSede & ", " & strGC & ", " & strCSR
MsgBox strMail
End If

Problem is that if I only select chkAGDLLA, then strMail will be "email1, email2, email3, email4, , , , , , ,"

I do not want all those commas, but how to make this work. I was thinking maybe a SELECT CASE so that strMail will accumulate data based on what's checked, but then there will be a problem of there being no comma between cases.

View 6 Replies View Related

General :: Saving Multiple Checkboxes To Table

Oct 16, 2013

I created a Microsoft Access database and access to the system must be controlled by User Access Level Control. The level of the user determines whether the user can add, edit, delete or view a certain form.

I created three tables which are linked via foreign keys: tblUsers, tblUserRoles and tblPermissions. (See the Tables attachment)

I designed the Permissions form to be user friendly by adding checkboxes on the form so that the Administrator can select whether a new user has Add, Edit, Delete or View rights. (See the User Level attachment)

To test my code I added a user as an Administrator. The problem is that when I select the Add, Edit, Delete and View checkboxes, it only saves the last checkbox to the Permissions table. The Administrator must have Add, Edit, Delete or View privileges on the Employees form, but now he only has View privileges. My code does not generate an error. (See the Incorrect attachment)

The Permissions table is suppose to save four entries(See the Correct attachment)

Here is my code.

Private Sub cmdSave_Click()
Dim rstPermissions As Object
Dim dbFSManagement As Object
Set dbFSManagement = CurrentDb
Set rstPermissions = New ADODB.recordSet

[Code] .....

View 14 Replies View Related

Filtering Records Based On Multiple Checkboxes

Apr 25, 2014

I am using Access 2013, I have a recipe project with multiple one-to-many relationships. The main table in all of them is RECIPE. Child tables are HOLIDAY, SPEC_NEED, COURSE... each one of these child tables are comprised of multiple checkbox columns (yes or no)...

I need to filter the RECIPE records based on the selected checkboxes in these child tables..so for example if COURSE.Appetizer is checked and HOLIDAY.Christmas is checked RECIPE will produce the appropriate records. How to pull this one off...I am currently using the Options Group design tool and have used a separate Options Group design for each of the child tables...

View 9 Replies View Related

Multiple Criteria In Select Query With 1 Like

Apr 22, 2008

Hi,

I'm trying to build a select query where it prompts the user for a few parameters. I've been having issues where people would misspell the vendor name and nothing pops up. I changed the vendor to Like [Vendor Name] & "*" but now I can't use the parameter of PO# without everything popping up. I have attached the SQL view. Thank you for any suggestions.

SELECT [Main Payment].[Batch#], [Main Payment].VendorName, [Main Payment].VoucherPrefix, [FY08 PAYMENT detail].VoucherNumber, [Main Payment].VoucherSuffix, [FY08 PAYMENT detail].Vchline1, [FY08 PAYMENT detail].PONo, [FY08 PAYMENT detail].InvoiceDate, [FY08 PAYMENT detail].InvoiceID, [FY08 PAYMENT detail].Amount
FROM [Main Payment] INNER JOIN [FY08 PAYMENT detail] ON [Main Payment].VoucherNumber = [FY08 PAYMENT detail].VoucherNumber
WHERE ((([FY08 PAYMENT detail].PONo)=[Enter PO#])) OR ((([Main Payment].[Batch#])=[Enter Batch #])) OR ((([FY08 PAYMENT detail].VoucherNumber)=[Enter Voucher #])) OR ((([Main Payment].VendorName) Like [Enter Vendor Name] & "*"));

View 3 Replies View Related

Conditionally Select Query Fields

May 10, 2007

Is there a way to select a query field based on conditions? There is a table at work that I need to use for my reporting in which the field names are the months of the year. Since my report is monthly for that specific month only, I have to change my field in the query every single month. I would like to be able to put in some type of code that will automatically select the proper month field.

Is this possible?

Thanks! :)

View 2 Replies View Related

Query With Parameter To Select Certain Fields

Jan 12, 2008

Hi, I need help in creating a parameterized query.

I need to show only certain fields depending on the value of the parameters.
For example, I have a table with fields: ID, Name, Phone Number, Address, DOB.
The parameter can only be value of A, B or C.
If the user input A as the parameter in the query, only field ID, and Name will be shown
If the user input B as the parameter in the query, field ID, Name and Phone Number will be shown.
etc.

Is there any way to do this, rather than to separate the query into 3 queries for each of the parameters? Thank you.

View 1 Replies View Related

Form To Select Fields For Query

Sep 14, 2006

I have written code to write a query with parameters set from selections made in a multiselect list box on a form.

I now want to add a check box for possible fields to include in the query and put these on the bottom of my form to allow users to select which fields they want to be displayed in the query result.

Can anyone advise how I can do this?

Many thanks,

Gary

View 1 Replies View Related

Multiple Fields Of Multiple Tables To One Table Query Or Report

Apr 12, 2013

I have 10 tables, 30+ fields on each table (every table has the same 'account number' field). I only need from 5 - 20 fields from each table. How do I get the certain fields from each table and put them in a table, query or report?

View 1 Replies View Related

Clearinf Multiple Checkboxes In A Table With A Click Of A Button.

Oct 19, 2004

I want to clear all the checkboxes in a certain field by using a command button on a form. I could use some help!!

View 3 Replies View Related

Forms :: How To Convert Multiple Drop Down List To Checkboxes

Jun 30, 2014

I've got a field in a table that is a multiple drop-down list. In the form, I don't want it to be a drop down list, but I want the options in the drop down list to be checkboxes instead (not within a drop down).

View 4 Replies View Related

Forms :: Multiple Checkboxes In A Form To Build A String?

Mar 18, 2015

From a dropdown field in the form it's currently possible to choose a geographical region for which to generate a report. The data populating this dropdown is pulled in from a Value List as follows:

" ";"*";1;2;3;4;5;6;7;8;9;10;11;12;13;EU;WD

I now need the ability to choose various different regions simultaneously which is not possible with the current method. I've looked into a nested continuous form and a multi-select combo box or list box, but none of these are as user friendly as my preferred method.

What I would like is 15 checkboxes plus a 16th to select/unselect all. When any of these checkboxes is checked, I need to create something like a dynamic value string or temporary table to hold the list of chosen regions until the generate button is clicked at which point the data is used to generate the report and cleared. I also need a piece of code to check/uncheck all the boxes.

View 3 Replies View Related

Select Multiple Criteria For Query On A Form

Oct 14, 2005

I was searching through here looking for a solution to the following problem:
I am building a Capacity database for work. The requirements require that users be able to sort by numerous criteria (Forecast Date, Portfolio, Market, Bucket, Month), all from a simple form that will spit out the results. Rather than creating unique queries for each combination of criteria(way too many!) or creating the SQL text in VBA, I played around until I came up with the following(which may have been done already, but I can't find it on here, so I'm not claiming to be brilliant...LOL). I have dropdowns on my form for each sort criteria-(Forecast Date, Portfolio, Market, Bucket, Month)

Then I created a query and for each criteria, I put this in:
Like (IIf(IsNull([Forms]![frmWAOFAdjustments]![Bucket]),"*",[Forms]![frmWAOFAdjustments]![Bucket]))

So if the user leaves a dropdown blank, the query simply brings back all the results from that field (Like *).

The text in bold is simply replaced with the dropdown name for each segmentation criteria. Next to each dropdown is a button that clears the dropdown box and requeries the listbox with the results(in case the user doesn't want to remove a criteria. This makes running searches for a specific number of accounts easy for the user and easy on me..lol.

Hopefully this can help someone out with a similar problem. I have learned so much from this forum, I just wanted to give something back. If anyone has any questions on this, just let me know.

View 2 Replies View Related

Adding Static Fields To A Select Query

Nov 15, 2005

I wish to add a static field to a select query i.e a field that does not exist within a table.

Does anyone know how I can do this?

Thanks

View 4 Replies View Related

Select All Query Fields For Main Form?

Sep 13, 2013

I have a table with about 3800 records and about 150 fields. It also has 4 tables with related data that each have only one field. I am going to create a query to base my from from. Should I just take the star * and get all the fields for each table or should i manually specify them. There are only about 5 fields out of the 150 that I dont need and I need to see the rest.

View 13 Replies View Related

Modules & VBA :: Checking Checkbox (from Multiple Checkboxes) Based On Field Value

Nov 29, 2013

I have a field 'Payment Types' with values (Cash, Cheque, Debit/Credit Card) and a field 'Payment Received' which is Yes/No.

When putting the order through the user selects the payment type and ticks a box if payment has been received.

On a report for delivery drivers, the owner wants it simple for the driver... he wants all the payment types listed with a checkbox next to each one, then wants the appropriate box ticked if payment has been received.

So I need something on the report (or underlying query) which ticks the appropriate box, i.e.

If payment received = true then payment type checkbox = true.

Or should I put the payments into a separate table with both fields so multiple payment types can be marked as paid?

View 6 Replies View Related

Help With Select Query To Get Single Line Instead Of Multiple Lines

Dec 21, 2007

Hi,

I have a query that selects values from a table and I'm further creating a letter based on this query. The problem i'm having is that if the query pulls 3 rows as result then it creates 3 separate letters. Basically this is how the output of query looks:

(refer attachment)

Is there any way to write this query so that I can get output as below:

Col1 Col2 Col3
10 20 10


Please advise.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved