Combining Two Boolean Values?

Feb 11, 2012

I basically have two yes/no fields in an access table. I want field one to have the value yes if field two has value no, and the other way around.

I had a look at the Boolean operators, but im not sure where to go from there.

View Replies


ADVERTISEMENT

Excluding Boolean Values From A Query

Mar 26, 2006

I have designed an invoice for a project that shows the amount of money needed to be paid, some of this has already been paid and some hasnt, how am i able to make it so that the values that have been paid and therefore have been checked are not include in the query. please help.

View 1 Replies View Related

Queries :: Convert Boolean Fields To Integers / Blank For Null Values

May 22, 2015

I have a query which returns, among other things, a number of boolean fields. In some cases, there will be a genuine True or False value in each of these fields; in others, it can and should be Null (e.g. as a result of a 'failed' LEFT JOIN of some description, where there is no associated record in the joined table which fulfills the criteria)

So something like this :

Code:
SELECT [tblTable2].[fldBooleanField]....
FROM [tblTable1]
LEFT JOIN [tblTable2]
ON [tblTable1].[SomeID] = [tblTable2].[SomeID]

However, I will be writing the result of the query to a text file and here's the problem. I want to show a numeric value for a genuine True / False (i.e. -1 and 0 respectively using the standard boolean conversions in Access) and a blank for any Null values.

So I tried this :

Code:
SELECT CInt([tblTable2].[fldBooleanField]) AS fldBooleanField....
FROM [tblTable1]
LEFT JOIN [tblTable2]
ON [tblTable1].[SomeID] = [tblTable2].[SomeID]

However, currently when I look at the exported recordset in Notepad, I am getting 0's for both False and Null values (and -1 for True)

How I can adapt my query to keep Nulls...null? And convert the genuinely present boolean values to integer form?

Only thing I can think of is to use (untested) :

Code:
IIf([tblTable2].[fldBooleanField] Is Null, Null, CInt([tblTable2].[fldBooleanField]))

But there's a number of boolean fields in there, all requiring the same treatment.

View 14 Replies View Related

Using Boolean 'and' To Update A Table Based On Values In A Link Table

Feb 24, 2008

The attached Access XP file demonstrates my problem. I've included a form to make testing easier.

Each record in the Projects table has one or more linked entries in the Keywordlink table, showing keywords that apply to that record. Each record in Projects has a Yes/No 'Utility' field.

A third table, Keywords, supplies the keywords that the user can apply to records in Projects, using the subform on the main form. The Keywords table also includes a True/False 'Utility' field. I have set this to True for for the first three keywords.

I need a query, a series of queries or some VB code that updates Projects_Utility for all records to True if and only if the record's linked entries in Keywordlink include all of the keywords for which Keywords_Utility is True (a boolean 'and', as opposed to an 'or'). Otherwise, Projects_Utility must be set to False.

In the attached file, with the current settings in the Keyword table, the 'GetSelectedProjects' query should then produce single-row listings for ClientA and ClientF.

I'd appreciate any help you can give me on this. I'm not a programmer, but I can manage a bit of VB code if I have to.

View 5 Replies View Related

Combining Values

Sep 9, 2005

I am pretty new to access and struggling with a query problem. I currently have a table containing data like:

Name_____________Color Chosen
Bill..............................Red
Bill..............................Blue
Tom............................Red
Mark...........................Green
Bill..............................Green
Tom............................Blue

And I would like to be able to get to

Name______________Colors Chosen
Bill..............................Red, Blue, Green
Tom............................Red, Blue
Mark...........................Green

Can anyone suggest a query to get me this second table. Theoretically the maximum number of Colors that one person can choose is 4.

Many thanks in advance

Chris

View 5 Replies View Related

Combining Values Of Comboboxes

Dec 20, 2006

Hi! I have a problem combining values of comboboxes, let me explain me better...

I have a text box and two comboboxes on a form
First, you introduce a data on the text box, then you select something of one of the comboboxes

the third combo box have to have the value of the text box and the value of the combo box separated by a comma or a space. Please help me with this. I need to finish this database soon:confused:

View 3 Replies View Related

Combining Calculated Values From Two Queries.

Aug 24, 2006

I have created two queries which calculates a total. I want to add the values of the two queries in a third query to give me a grand total.

When I try to create this third query, it gives me an error saying that the fields cannot be used from two different queries. So I'm just wondering whether this is possible or is there any other way of doing this.

View 1 Replies View Related

Forms :: Combining Values In Expression Using IIF?

Apr 30, 2014

I'm trying to create a text box on a form which displays a value based on numerous criteria.

Basically I manage a database of employees. Some are external employees, some are internal. Some have left the organisation, and some are still employees.

I have two fields which need to be pulled into this expression:

is_leaver - text box, with value either "Yes" or NULL

organisation - name of organisation (text)... lets say my organisation is called Happy People Ltd

The text box I have is called employee_status

I can see that there are 4 possible combinations:

1. Internal Employee - Is an internal employee and still works here
2. Internal Ex-Employee - Is an internal employee but has left
3. External Employee - Is an external employee who still works here
4. External Ex-Employee - Is an external employee who has left

So far I've managed this:

Code:
=IIf(IsNull([is_leaver]),"Employee","Ex-Employee")

This displays whether they're an employee or ex-employee. How would I form the expression to combine the two fields, and calcuate whether they're internal or external?

Due to the way the form is set up I don't want to have two separate text boxes and would prefer to combine it.

View 5 Replies View Related

Reports :: Combining Same Values From Two Fields

Aug 21, 2013

I would like to make a report to show how many employees and which employees are attending to which colleges/universities.

In my data (800 records), I have two fields which is "College 1" and "College 2" for each employee.

There are values that are enter in college 1 for some employees, other employees have the same value that is enter in in college 2. How do I get to show a report that has all the employees who attended the same college in either college 1 or 2?

For instance, this is my raw data:

Name - College 1 - College 2
Bob - University of HI - Honolulu CC
Sandy - Honolulu CC - University of HI
Clare - Kapiolani CC - University of HI
John - University of HI - Windardward CC

I want my report to show:

Colleges -
University of HI
Bob
Sandy
Clare
John

Honolulu CC
Bob
Sandy

Kapiolani CC
Clare

Windard CC
John

View 4 Replies View Related

Combining Rows With Duplicate Values

Jun 17, 2013

I am working with an Excel file of raw data aggregated from an annual customer relationship survey that has been sent out since 2010. The file has approximately 20,000 rows, meaning the survey has been taken around 20,000 times. Unfortunately, each time a customer takes the survey, it is included in the raw data as a separate entry. Therefore the file has numerous duplicate email addresses, corresponding with unique data for each time the survey was taken. Another issue regarding the data, is that in the first year the survey was sent out, the distribution mechanism "broke" and the survey was sent out multiple times (and completed multiple times) in the same year by the same customer, so the surveys are not necessarily uniformly distributed, if that makes sense.

I have been interested in isolating the common respondents (those who have taken the survey across multiple years, albeit not necessarily consecutive years). Up to this point, these respondents have been isolated manually using a pivot table, however I am now looking to enter the raw data into SPSS (a statistical analysis package), in order to view the drivers of these common respondents.

Therefore, I would like to be able to isolate these common respondents and the data corresponding with their surveys from the raw data in a separate worksheet or file. I have tried various formulas to do so in Excel to no avail. Is there anyway to accomplish this in Access or would a more complex database be needed?

Ideally the final product would have the common respondents' information from multiple surveys in one row and would be able to be filtered by feedback date (found in the raw data), so that hypothetically one could select a month and be able to tell how many customers considered to be common respondents completed a survey within that month.

View 8 Replies View Related

Combining Two Text Box Values Into One Label

Jun 12, 2013

I have two text boxes, and i want to make there value be the label for the form. Here is what i have in the Label on the form:

=Nz([Last Name] And [First Game],"Untitled")

Where am i going wrong?

View 5 Replies View Related

Queries :: Combining Fields - Spacing Between Values

Mar 6, 2014

I'm creating a query which pulls together the numerical values of 32 separate fields. Each field has the potential to have a value in it ranging between 1 and 9, but most fields will be blank.

I want to prefix the value (if the value is not null) with a 2 or 3 character-long code relating to the field name.I then want to combine them all together in a query so I can easily copy and paste the output to a spreadsheet.Here is what I have so far, with just 9 of the field names, and it's already looking a bit clunky.

Code:

IIf(IsNull([zam_adm]),"","ADM") & [zam_adm] & " " &
IIf(IsNull([zam_cts]),"","CTS") & [zam_cts] & " " &
IIf(IsNull([zam_crs]),"","CRS") & [zam_crs]& " " &
IIf(IsNull([zam_IPB]),"","IPB") & [zam_IPB]& " " &
IIf(IsNull([zam_opr]),"","OPR") & [zam_opr]& " " &
IIf(IsNull([zam_owl]),"","OWL") & [zam_owl]& " " &
IIf(IsNull([zam_pmi]),"","PMI") & [zam_pmi]& " " &
IIf(IsNull([zam_wl]),"","WL") & [zam_wl]& " " &
IIf(IsNull([zam_sgt]),"","SGT") & [zam_sgt]

The output, unfortunately, is putting spaces between empty fields and I'm not sure how to prevent this in the syntax?

View 3 Replies View Related

Queries :: Combining Columns And Replacing Certain Values

Sep 29, 2014

I need to create a query that combines two columns (lets say Column A and Column B for example) however the problem is that whatever non-null values that are in Column B must replace any value in Column A. If Column B has a value that is null then Column A's value is shown.

I have an example of what I'm working with (access file) and what result I want (excel file).

View 2 Replies View Related

Forms :: Combining Date And Time Values Using DateDiff

Jul 8, 2014

I'm trying to create my own database dealing with hiring bikes on a daily basis.

I have created a form for the basic input, including StartDate, StartTime, EndDate and EndTime, followed by TotalDays. I added the time field so that if a client brings a bike back an hour or two after the pickup time on a later date (sounds complicated - e.g he takes it on Monday at 12pm until Thursday 14pm) then he would be charged for an extra day. It is similar to the car rental system used worldwide.

The TotalDays is currently using a simple expression =EndDate-StartDate.

Is there any way to make the form incorporate the time difference so that if EndTime-StartTime>1 then it would add an extra day to the "=EndDate-StartDate" calculation.

View 3 Replies View Related

Queries :: Drop Down - Query Not Combining And Filtering Values Based On A Form

Jul 22, 2014

I have a form (DropDown form) that has 3 drop down fields, you select your values from the drop downs and you would push a command button that runs an event procedure which runs a query (DropDown qry test). The user should have the option of picking any combination of fields to filter by. Or no combination, which would return all values in all fields. So I am basically using the form as parameter's for the query.

The problem I'm having is that my query is returning values for one field AND values for another field. Even if the other values selected are not in the same record. It's not combining the fields together to filter. For example: you pick a Project name and Supplier name, the query will return records that have the project name you selected but it will also return records with the supplier name you selected that have a different project name.

I've attached screen shots of the form and the design view of the query (the screen shot cut off the last column name. It is meant to say "Expr3: [Forms]![DropDown form]![Combo7]").

Using Windows 7,
Access 2010

Is there a way to select multiple values from the drop downs?

View 14 Replies View Related

Combining Multiple Columns Into One Longer Column (without Combining Fields)

Jul 17, 2013

I trying to combine three columns that I have into one column without combining fields.

Currently what I have:
(see image below)

What I want:
ID-----MOC
##----name1
##----name2
##----name3
##----name4
##----name5
etc

The list I have will be much longer and will be changing frequently, which is why I can't just go on excel and manually do this.

View 14 Replies View Related

Queries :: Combining Queries Without Matching ID Values

Feb 2, 2015

I have two queries:

1. a sum of payments by individuals
2. a sum of charges of individuals.

I want to combine these queries to create a report that shows the sums for each person of the charges and payments and calculate the balance. However, it is only showing me those individuals that have both a charge sum and a payment sum, while some individuals will only have a charge sum. How do I get those individuals to show and show with a zero payment balance if they are in my charge sum query but not my payment sum query and vice versa (some may have made a prepayment even though they have not been charged yet).

View 5 Replies View Related

Boolean Declaration

Nov 9, 2005

Hi,

In ADP project I want declare ckeckbox data:

dim strDec as String

strDec = 1 ' if True
strDec = 0 ' if False

How can I show all records:
strDec = ? ' Show all recrords (true and false)

?

View 2 Replies View Related

Please Look At This Boolean Vs String

Dec 2, 2005

I'm working on a software that was developed by someone who left the company. The problem is that the software works for all locations execpt one that is in austria, after debuging I found out that there is a statement in the code that uses boolean true or false, the only way it worked is when I put an if statement with false or true as string, ex: if doc = "true" then
buttom line has anyone faced this problem, I searched microsoft website and they said that some vb engines don't convert boolean to string. Please Please if someone has a clue try to help. Thanks.

View 4 Replies View Related

Boolean Searches? Possible?

Jun 21, 2005

I have a search tool, but right now it is 100% case sensitive in the sense that if i search for "test" and my entry is "Test" it will not return any results.

is there any way to setup so I could say search for "Test" and it would find "test" properly? Or even to the extreme where I searched for "Tes*" and it came back with the "test" entry.

Thanks,

View 8 Replies View Related

Boolean Value In Query

Nov 2, 2004

I am creating table in ms access using query. How to specify data type for a boolean fields ie YES/No or TRUE/FALSE?

with regards
shruthi

View 2 Replies View Related

Boolean Type Search

Oct 31, 2007

I need to create a user interface that will allow a boolean type search of a field. This would mean item1 AND item2 AND NOT item 3, item1 or item2, item 1 NOT item2, etc.

I've set up a combo box setup with the following script, but I can't figure out how to adjust it to allow the multiples.

Please advise if I should adjust this or try a differenmt interface format for my users.

__________________________________________________ ________

Option Compare Database 'Use database order for string comparisons
Option Explicit

Private Function AfterCombo(WhichLine As Integer)
Dim CBox As Control, TBox As Control, AndBox As Control, TBoxA As Control
Set CBox = Me("Combo" & WhichLine)
Set TBox = Me("Value" & WhichLine)
Set AndBox = Me("And" & WhichLine)
Set TBoxA = Me("Value" & WhichLine & "A")
TBox = Null
TBoxA = Null
Select Case CBox
Case "All", "Blank", "Not Blank"
TBox.Visible = False
AndBox.Visible = False
TBoxA.Visible = False
Case "Like", "Equal", "Less Than", "Greater Than", "Not Like", "Not Equal", "Not Less Than", "Not Greater Than", "In List", "Not In List"
TBox.Visible = True
AndBox.Visible = False
TBoxA.Visible = False
Case "Between", "Not Between"
TBox.Visible = True
AndBox.Visible = True
TBoxA.Visible = True
End Select
End Function

Private Sub Cancel_Click()
DoCmd.Close
End Sub

Private Function FormatList(ByVal List As String, FieldType As Integer)
Dim NewList As String, CommaPos As Integer, Word As String
NewList = ""
Do While Len(List) > 0
CommaPos = InStr(List, ",")
If CommaPos = 0 Then
Word = Trim(List)
List = ""
Else
Word = Trim(Left(List, CommaPos - 1))
List = Trim(Mid(List, CommaPos + 1))
End If
If Word > "" Then
Select Case FieldType
Case DB_TEXT, DB_MEMO
If InStr(Word, """") > 0 Then
MsgBox "Don't type double-quotes in the list"
End
End If
Word = """" & Word & """"
Case DB_DATE
If InStr(Word, "#") > 0 Then
MsgBox "Don't type '#' in your dates"
End
End If
If Not IsDate(Word) Then
MsgBox "Your list contains non-date characters"
End
End If
Word = "#" & Word & "#"
Case Else
If Not IsNumeric(Word) Then
MsgBox "Your list contains non-numeric characters"
End
End If
End Select
NewList = NewList & "," & Word
End If
Loop
NewList = Mid(NewList, 2)
If NewList = "" Then
MsgBox "Your list needs a valid value"
End
End If
FormatList = NewList
End Function

Private Function MakeNull(C As Control)
If Len(Trim(C)) < 1 Then C = Null
End Function

Private Function MakeSQL(WhichLine As Integer, FieldName As String, FieldType As Integer) As Variant
Dim CBox As Variant, TBox As Variant, TBoxA As Variant
Dim Condition As Variant, Delim1 As String, Delim2 As String
CBox = Me("Combo" & WhichLine)
TBox = Me("Value" & WhichLine)
TBoxA = Me("Value" & WhichLine & "A")
Select Case CBox
Case "Like", "Equal", "Less Than", "Greater Than", "In", "Not Like", "Not Equal", "Not Less Than", "Not Greater Than", "Not In"
If IsNull(TBox) Then
MsgBox "You have left a parameter blank for field [" & FieldName & "]"
End
End If
Case "Between", "Not Between"
If IsNull(TBox) Or IsNull(TBoxA) Then
MsgBox "You have left a parameter blank for field [" & FieldName & "]"
End
End If
End Select
Select Case FieldType
Case DB_TEXT, DB_MEMO
Delim1 = """"
Delim2 = """"
If Not IsNull(TBox) Then TBox = QFix(TBox)
If Not IsNull(TBoxA) Then TBoxA = QFix(TBoxA)
Case DB_DATE
Delim1 = "#"
Delim2 = "#"
Case Else
Delim1 = ""
Delim2 = ""
End Select
Select Case CBox
Case "All"
Condition = Null
Case "Blank"
Condition = " Is Null"
Case "Not Blank"
Condition = " Is Not Null"
Case "Like"
Condition = " Like """ & TBox & """"
Case "Equal"
Condition = "=" & Delim1 & TBox & Delim2
Case "Less Than"
Condition = "<" & Delim1 & TBox & Delim2
Case "Greater Than"
Condition = ">" & Delim1 & TBox & Delim2
Case "Not Like"
Condition = " Not Like """ & TBox & """"
Case "Not Equal"
Condition = "<>" & Delim1 & TBox & Delim2
Case "Not Less Than"
Condition = ">=" & Delim1 & TBox & Delim2
Case "Not Greater Than"
Condition = "<=" & Delim1 & TBox & Delim2
Case "In List"
Condition = " In(" & FormatList(TBox, FieldType) & ")"
Case "Not In List"
Condition = " Not In(" & FormatList(TBox, FieldType) & ")"
Case "Between"
Condition = " Between " & Delim1 & TBox & Delim2 & " And " & Delim1 & TBoxA & Delim2
Case "Not Between"
Condition = " Not Between " & Delim1 & TBox & Delim2 & " And " & Delim1 & TBoxA & Delim2
End Select
MakeSQL = " And [" + FieldName + "]" + Condition
End Function

Private Sub OK_Click()
Dim Where As String
Const ObType = "Form"
Where = Where & MakeSQL(1, "Lyrics", 10)
Where = Where & MakeSQL(2, "TrackTitle", 10)

On Error GoTo OKCApplyError
If Where <> "" Then
Where = Mid(Where, 6)
DoCmd.OpenForm "MasterFormQuery", , , Where
Else
DoCmd.OpenForm "MasterFormQuery"
End If

OKCExit:
Exit Sub

OKCApplyError:
MsgBox "Error " & Err & " opening " & ObType & Chr$(13) & Chr$(10) & Error
Resume OKCExit

End Sub

Private Function QFix(ByVal X)
Dim P As Integer
If IsNull(X) Then
QFix = Null
Exit Function
End If
P = InStr(X, """")
Do While P > 0
X = Left$(X, P) & """" & Mid$(X, P + 1)
P = InStr(P + 2, X, """")
Loop
QFix = X
End Function

Private Sub exitselectform_Click()
On Error GoTo Err_exitselectform_Click


DoCmd.Close

Exit_exitselectform_Click:
Exit Sub

Err_exitselectform_Click:
MsgBox Err.Description
Resume Exit_exitselectform_Click

End Sub

View 9 Replies View Related

Queries :: Count Boolean By Row?

Feb 11, 2015

I have a table with seven Boolean fields: I need to count all the "trues" and return the row if the sum of the trues is greater than 3.how to do this.

View 2 Replies View Related

How To Change To Boolean Data Type??

Apr 17, 2007

my teacher asked me to do Access homework to change data type from Text to Boolean. Data in "Owned car" field show as Y or N
17178
so I click on Design View and change datatype of this field from "Text" to "Yes/No" , than when I saved it show a message
17179
When I back to Datasheet view, all data in "Owned car" field change to be "No".

How can I change data type to be Boolean type without deleting my original data??? I want them to show the same as Y or N.

View 1 Replies View Related

Forms :: Boolean Checkbox Updates

Aug 4, 2013

I use a form for changing data. So when the user selects a record from a listbox I fill all fields of the form with the content relating to the selected line in the box. Nearly everything runs as wished.

All updates take place immediately but the Boolean field does not update or better it updates only after I move the cursor over it. Then it is correct. To make it clear, I do not need to press a button or click, I only move the cursor over the boolean checkbox.

I access VBA after clicking the line in the listbox and use the dlookup command to get the right values. Do I need something like a requery for a boolean field ?

View 3 Replies View Related

Modules & VBA :: How To Check If Boolean Variable Has Been Set

Nov 25, 2014

I have an Access 2010 db which has a load of global variables of type Boolean. The values are different for each machine the database is stored on, so I have a linked table to a separate Access mdb. On startup the database opens the linked table and assigns values to each variable.

However I need to differentiate between a valuable value of False and the variable having not been set. As boolean variables default to False, this is a problem. One option is to use data type Variant, but I know this is not efficient. I am considering using data type Byte instead of Boolean, with 1 as False and 2 as True.

View 7 Replies View Related







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