How To Use Expressions With Missing Values

Jun 11, 2007

I use a left join to join table A with table B. Table B has less matching records , so in the resulting table the field [RESULT] which comes from the table B has empty values.

If I use an expression for a new field PROCENT that involves [RESULT] I got #ERROR in all records with missing [RESULT] value. I tried various IF statements , but even IsError () function produces #ERROR.

It seems that ACCESS 2002 fails to detect missing values and gives an error for any operation. Is there any workaround for this problem?



Example
PROD_PERCENT: IIf([RESULT]>0,[RESULT]/[NETTO],0)

View Replies


ADVERTISEMENT

Dealing With Null Values In Math Expressions

May 11, 2006

Hi all,

I am in desperate need of some advice. Today I set to work building some math functions in my queries to calculate delays/turnaround times for work, etc.

I have found that where there are null values in my table - the calculation seems to break down.

Let me explain...

In it's simplest form (I have removed some fields and will deal with DATE only, not TIME which is a seperate field) I have the following -

Date_Received
Date_Started
Date_Pended
Date_Recommenced
Date_Completed

I have the following expressions in my query -

Turnaround: Date_Completed - Date_Received
TimePended: Date_Recommenced - Date_Pended
TimeInactive: Date_Started - Date_Received
Workrate: Turnaround - (TimePended + TimeInactive)

The query calculation will only work when all fields contain a value.

For instance, sometimes the work may be started, then completed. Skipping the 'Pended' and 'Recommenced' steps.

Can anyone tell me what I need to include in my maths for Access to treat a null value in the table as zero? Or any other approach.

Please help!!!!!

Thanks

Rob :eek:

View 3 Replies View Related

Help With Function/missing Values

Oct 18, 2007

Hello People!

I am trying to create a new variable that will indicate whether a person has a family history of breast cancer (1=yes). The values for the 4 source variables are either the number 1 or are blank/missing ("no" was not captured). Any help here is greatly appreciated.

Option Compare Database
Option Explicit

Public Function fnBrCaFaHx(BrstAny, BrstMth, Brst1Sis, Brst2Sis As Byte) As Byte
' Determine if participant has a family history of breast cancer.
If BrstAny = 1 Or BrstMth = 1 Or Brst1Sis = 1 Or Brst2Sis = 1 Then
BrCaFaHx = 1
Else
Exit Function
End If
End Function

View 9 Replies View Related

Importing Data With Missing Values?

Feb 4, 2014

Below is a text file that we need to import from a POS system but the layout is not conducive to a typical database import. 2500 series of numbers are in the second field of the table and I would like to add that account number to the second field for each row and I would like to add the date 4 the field of each line but not sure how I would accomplish this.

" "|"25000.....0793"
" "|" "|"Name of city, R1"|"01/25/2014 17:31:43"|80079| 21.23|"BROCCOLI"| 0.00|"Client"|1
" "|" "|""|""|""|""|"SALMON OSCAR"| 19.59|""|""
" "|" "|""|""|""|""|"WATER"| 0.00|""|""
" "|" "|""|""|""|""|"WILD RICE"| 0.00|""|""
" "|" "|""|"01/25/2014 18:26:56"|30060| 26.02|"***AS APP***"| 0.00|"Server"|1

[code]....

View 1 Replies View Related

Query For Missing Values From Training Database

Dec 2, 2006

Hi

I have inherited a database that contains details of staff training data and the tables contain the following:

Personal Information Table:
PersonalID
Surname
Forename
EmploymentStatus (this contains either Staff, Operative, or Supervisor)

Training Courses Table:
CourseID
Course Name
Course Description
Supervisor (Yes/No)
Operative (Yes/No)
Staff (Yes/No)

Training Courses Attended Table:
RecordID
PersonalID
CourseID
Date

Each of the courses in the Training Courses Table should be attended by one or more of the groups identified in the EmploymentStatus field (ie. Supervisor, Operative, Staff) and the relevant field in the Training Courses Table is flagged eg.
Training Courses Table:
CourseID, CourseName, Supervisor, Operative, Staff
100, basic safety, Yes, Yes, Yes
101, safety management, Yes, No, No
102, working with ladders, No, Yes, No
103, VDU, No, Yes, Yes

I need to identify which individuals have not attended the courses that they should have been completed (ie. compare courses attended with the list of courses associated with the EmploymentStatus associated with individual staff members, and identify which courses have no attendance dates).
How can I structure the query, I can't see how to do this with the existing tables, but I think it should be possible, but my Access expertise is just not good enough to work through this.

Any advice would be much appreciated.

View 1 Replies View Related

Forms :: Sorting Missing Null Values?

Jun 19, 2013

Im trying to sort a form on a date. it only has dates put in once a confirmed date is known so when i sort all the blanks come to the top is there a way of sorting excluding null values

View 9 Replies View Related

Tables :: Accounting For Missing Values In A Calculated Field

Mar 24, 2014

I have a table that stores information for multiple behavioral surveys (numerical values). My goal is to add the proper fields that compose total scores value for each respective survey (do a summation of scores). Now, under design view for my table, I see that I can add a calculated field. When I create this calculated field, I can use the Expression Builder to do a sum of the proper fields (the fields that compose a total score for a survey). The only problem that I'm encountering is that if a field that is part of a survey is missing information, the summation disregards the rest of the values for that survey.

How can I account for these missing values so that, if 1 out of my 9 fields have information, I will still get a summation score for the 9 fields? I want to be able to do this without having to change the value of the missing field to 0.

In SPSS I can easily do this by computing a variable and using a code like this:
SUM.2(field1, field2, field3, etc.)

View 6 Replies View Related

Queries :: Missing Days - Creating Table With 31 Days Of Zero Values

Apr 3, 2013

Client has asked me to create a report showing summary of monthly sales by day. That was easy. I created a query for the month the user selected and then summarized and group the data by day. Client like the result but would like to see zeros on the report for non sales days. Non sales days are days like holidays and there are no sales.

I am thinking of creating an table with 31 days of zero values and then join the two tables in a query? Or, should I create a temporary table with code and then merge the two tables which the existing query which I can then use for the report?

View 4 Replies View Related

Missing Records (and Missing Updates)

Oct 7, 2005

Hi all

This is an ongoing problem I have had for 4 weeks now.

I have made a a system thats acts like a clock In/clock out Out system.

the structure is somthing like this
ID
Username
tblDailyLog
TimeIn
MorningBreakOut
MorningBreakOut
LunchOut
LunchIn
AfternoonOut
AfternoonIn
TimeOut

All fields apart from ID (autonumber) and username (String*255) are Date field (there are a few others like DateOfTimesheet etc but they arnt important here)

When a user arrives in the morning they make a record which they use for the day

They then have a form with a whole bunch of buttons which simply updates the correct field. For example they click the "Sign in for the Day" button and it updates the correct field with the current time.

Everything was going fine until people noticed that every now and again a sign in time dissapeared.

I have hacked myself to death trying to solve this problem but still the updates go Astray.


Now each time a time is updated the process goes somthing like this


1. the user opens their timesheet for the day (the RS is SNAPSHOT and no locks)

2. User Hits a sign in/out button
3. The record source is changed to "" and all buttons hidden (to ensure the record isnt locked and to make sure you dont do two things at once)
3. The table is updated with the new time (using some dynamic SQL)
4. The table is repeatadly checked using a DO loop to make sure the the correct time went in.
5. when the returned time value of the field matches the varaible used to update it, the form is returned to normal and the user carries on his/her merry way (if it never matches the screen should crash but this never happens).
6. A New record is added to another table called "tblbugfixinglog" which records which field was updated and when. This is so that I have two records in two different ways (figured if one went astray I could pull it back off the other)
7. Another new record is added to yet another table called tblSQLRecord, which simply logs all .RUNSQL statements that are executed.


I thought that the two extra tables (and the check that the record had been updated) would help me track down where the records are going missing, but this isnt the case.

Now it appears that some records arnt being added to tblBugFixingLog and to tblSQLRecord either and some of these tables are getting quite a few #ERROR's in them..

None of the tables are related to any other and i've no idea how #ERROR lines are appearing in a table that has 1 function... to recieve new records ... no editing, no viewing, no deleting.

Does anyone have any idea how these updates/inserts can go missing or create #ERRORs.
I've built plenty of Databases in my time and have never come across this.
__________________________________________________ ______________

This is the function I use to add a record to tblBugfixingLog and tblSQLRecord


Private Sub AddBugLog(ByVal TimesheetNumber As Long, ByVal FieldUpdating As String, ByVal NewFieldValue)
Dim TempSQL As String
TempSQL = "INSERT INTO tblBugFixingLog (TimeAndDateOfEntrySERVER,TimeAndDateOfEntryPC,Fie ldUpdated,NewEntry,UserID,TimesheetNumber,Computer AssetNo) VALUES (" & _
"#" & Format(ServerGetTime(Environ$("LOGONSERVER"))) & "#," & _
"#" & Now & "#," & _
"'" & FieldUpdating & "'," & _
"'" & NewFieldValue & "'," & _
"'" & GetNTUser & "'," & _
"'" & TimesheetNumber & "'," & _
"'" & fOSMachineName & "')"
' MsgBox TempSQL
DoCmd.RunSQL "INSERT INTO tblSQLRecord (Username,DateAndTime,Screen,TheSQL) VALUES('" & LoginInfo.sUsername & "','" & CStr(Now) & "','Add Bug Log function','" & CleanData(TempSQL) & "')", False
'CleanData is a function that removes ' and " from the SQL string so i can easily add the SQL string into the table
DoCmd.RunSQL TempSQL, False
End Sub

Public Function CleanData(ByVal DataToClean As String)
Dim TempData As String
Dim i As Integer
TempData = ""
For i = 1 To Len(DataToClean)
Select Case Mid(DataToClean, i, 1)
Case "'"
TempData = TempData & "`"
Case """"
TempData = TempData & "`"
Case Else
TempData = TempData & Mid(DataToClean, i, 1)
End Select
Next i
CleanData = TempData
End Function


__________________________________________________ ____


I have no idea how this can create #ERROR lines in the table when it is just added to and nothing else.

Does anyone have any clue to what may be happening here.

(Oh yeah and no matter how hard I try, I can't replicate the problem.... works for me every time no matter how harse I am to it!)

Please save what little hair I have left and give me some hope

Cheers
Homer

View 1 Replies View Related

Expressions

Mar 4, 2008

I have a table that has questions that require Yes/No answers, simple done, however now for the tricky (or at least for me, VV new to Access) I need one of the fields to add up all the Yes and asign a value so for example:
Q1 Q2 Q3 Q4 Q5 Result
Y N Y Y N 3
How do I do this, I asume it is down to the expression for 'Field' Result but what should that expression be and where do I put it?

View 7 Replies View Related

Expressions

Jul 29, 2006

Help me what is wrong with this expression:eek: :

=IIF( [eBay Method] ="Auction",
IIF( [Start up Price] <=.99,.2,
IIF( [Start up Price] < = 9.99,.35,
IIF( [Start up Price] < =24.99,.6,
IIF( [Start up Price] < =49.99,1.2,
IIF( [Start up Price] < =199.99,2.4,
IIF( [Start up Price] < =499.99,3.6,
IIF( [Start up Price] >499.99,4.8," "
))))))),
IIF( [eBay Method] ="Buy it Now",
IIF( [Start up Price] <=9.99,.05,
IIF( [Start up Price] <=24.99,.1,
IIF( [Start up Price] <=49.99,.2,
IIF( [Start up Price] <=49.99,.25," "
))))))

View 4 Replies View Related

Unsafe Expressions

Jul 13, 2005

I'm using Windows 2K SP4 and have just installed Office 2003. Everytime I open Access I get a message asking if I want to block unsafe expressions (presumably macros). How can I turn this off?

BTW I've downloaded all of the security updates, which are recommended by MS.

View 7 Replies View Related

Unsafe Expressions...........??

Apr 5, 2007

Hi,

Can anyone tell me why it is that when i have written a DB on one machine using Access 2003 and then subsequently put that DB on to another machine i get an error relating to unsafe expressions?

why does this happen and is there a away in which can stop this error message from appearing?

I am trying to implement the DB i have written at work but it does not look good when i get a constant error message appearing when ever i open the DB.

Thank you in advace for your help

Regards
Bev

View 3 Replies View Related

Question Regarding Expressions

Feb 29, 2008

1)I have a list of stock opening prices and closing prices for March. i need an expression or function that will calculate which company's stock price changed most during the month (difference between opening and closing price). 2)In the stock table, I have dates given to me in the following format mm/dd/yyyy. Lets say I want it only to display the date so it only shows the month but not the year of the day. What function will give me this result?Thanks

View 1 Replies View Related

Questions About Possible Expressions

Jan 8, 2007

I have a complicated question here. I am currently building a db for career development in my workplace. The main fields that i am having some issues with is the following. I have three fields labelled as the following:

1)Last Review date

2)Next review date ( i have this entered in as an auto generated date-- will add one year from the last review date)

3)Status

Now here is my question:

I want my status field to auto generate as well-- say if the last review date was in 2005 and the next review date was dec.12/06-- then the status would currently be overdue.
Is there any expression to use to auto generate the status field to say whether it is overdue or completed? or is there any easier way to do this?

View 5 Replies View Related

Counts And Expressions

Jul 8, 2005

I’m starting to wonder how I ever made anything work, before I found this place.

I built 2 queries and put them in a query

They share a common field

The join type is all record from Query1 and Matching from Query2

Next I added a count field for each

Then I added a calculated field that subtracts the count from Query1 to Query2.

So far it all works

When I add >0 to the criteria for the calculated field a dialog box pops up asking for the values of the fields expressed the calculated field.

View 2 Replies View Related

Text Expressions

Jul 19, 2006

i have a master table with various lookup feilds. i want to create a querie that creates a text expression feild called description and it is based on the info provided in the lookup feild. problem is when i create this querie from the location master it provides the id's from the lookup colums and not their text.

any solution

View 4 Replies View Related

Help Need For Expressions Builder

Aug 1, 2006

Hi experts

I have some problems consists of using Conditions.
I have 4 tables in Access:
tbl1_School names, addresses, ID_Number etc..
tbl2_ School features with Number of Clesses, Number of Students, total Area etc.
tbl3_teaching stuff with names, occcupations, Ages ets. and
tbl4_nonteaching personal with names, occupations. ages, etc.

References is ID_Number of schools
I make Query with relations, but do know how to build Expressions Builder for this:
Question 1.
a)If school have between 300&500 Students there are ig.18 teachers,
b)if schools have between 500&800 Students there are ig.25 teachers and until 1500 Students there are ig. 50 teachers.
Question 2.
c)if school have area until 400 m^2 there are needed ig. 8 nonteaching personel,
d)if school have from 400 till 600 m^2 there are needed ig. 15 nonteaching personel.

Numbers I specified like examples ig. were prescribed bye regulation.

If someone want to help me how can I use Expression Builder or VBA Code it would be appreciated.

It means I should use Condition Commands.

Thank You for help.

View 6 Replies View Related

Using Expressions As Criteria

Jul 17, 2007

Is there anyway to use an if statemet to define the criteria for a query?

as in

if forms!RunReport!cboname <> "" then
query all names that equal forms!RunReport!cboname
end if

also is there any way to use a dlookup function (or another similar function)
to define several criteria for my query

ex.
i have a table, "modules", with a list of modules, each classified as "digital" or "analog" and i want to view all records containing analog modules from a different table, "info"

thanks for any help in advance

View 4 Replies View Related

Expressions In A Query

Feb 29, 2008

Hi all!

I'm new to this forum and could use some help on a simple Access app. I have attached the relations for the db. I need to collect some data to a subform as:
tblFunctionCodes.FunctionCode,
tblAccounts.AccountNumber,
Monday (hours),
Tuesday (hours),
Wednesday (Hours),
Thursday (hours),
Friday (hours),
Saturday (hours),
Sunday (hours)
Where I have the tblEmployees.EmployeeID, tblDates.DateWeek and tblDates.DateYear as variables.
The weekdays need to be an expression with my current design, which seems to work ok from Monday to Saturday, but when I throw in Sunday Access says the query is too complicated.

I have this query to get the data, but with no expressions (can't get it to work):

SELECT tblFunctionCodes.FunctionCode, tblAccounts.AccountNumber, tblRegistrations.Hours, tblDates.DateWeekDay
FROM tblFunctionCodes INNER JOIN (tblEmployees INNER JOIN (tblDates INNER JOIN (tblAccounts INNER JOIN tblRegistrations ON tblAccounts.AccountID=tblRegistrations.AccountID) ON tblDates.DateID=tblRegistrations.Date) ON tblEmployees.EmployeeID=tblRegistrations.EmployeeI D) ON tblFunctionCodes.FunctionCodeID=tblRegistrations.F unctionCodeID
WHERE (((tblRegistrations.EmployeeID)=[intEmployeeID]) AND ((tblDates.DateWeek)=[intWeek]) AND ((tblDates.DateYear)=[intYear]));


I've been trying to use that as a foundation for other queries but I just can't get it to work. Does any of your guys have any ideas? Maybe an INTERSECT query??

Anyway I'm out of ideas and very pressed to makes this work. Any ideas are welcome!

Thanks in advance, jon.

View 10 Replies View Related

Help With Expressions On Forms

Jul 6, 2005

Hi all, I'm writing a database basically as a favour to someone. I'm a sql analyst/programmer so my access and vba skills are a little limited and I hope someone can help me with a problem I have.

Part of one of my forms is a flow chart style set of Yes/No questions and the user answers each question. For each question I have created a (hidden) text box which calculates a score (5 for no, 10 for yes) which I have done with a IIF expression in the Control Source of the text box. These are then totalled to give an overall score.

This score is then used to calculate a grade (A or B) and a percentage score using the same IIF method in the control source.

What I want to do though, is use this grade and percentage and write it to the individual record as data in the table - to use in reports and such like.
Is there any way I can do this? I've tried a few bits of VBA but to no avail. Is there a way that this can be done? Or have I approached this in entirely the wrong way??!!? :confused:

Any help would be greatly appreciated!

View 2 Replies View Related

Expressions In Forms

Nov 24, 2005

Hi,

Is there a way on Access that when a total is calculated using an expression on a form that it could update the table itself with that total?

Thanks for any help!


Roly

View 1 Replies View Related

Using Switch Functions In Expressions.

Oct 10, 2005

i'm trying to use a switch function in a query but i'm unfamiliar with the format a bit. here is what i'm trying to do...

switch([Radios]![Warranty] and [Radios]![HousingWarranty]=true,[Radios]![Change front housing]*(25/60*28), [[Radios]![Warranty] And [Radios]![PortableHousingWarranty]=true], [Radios]![MaterialsUsedPrice1])

basically first statement is condition second is execution. I need to add more but i'm getting an error from this much...if I was doing this in vb.net I would just do if, ifelse, ifelse, ifelse...but...

Thanks,

View 2 Replies View Related

Unsafe Expressions A2K2

Jan 9, 2007

I have recently deployed an application at work [work pcs all running A2K2], built with A2K3 on home computer.

I split the database housing the backend on our server, named server, and using frontends on users pcs.

I am running a VB script that takes information from another linked db on server (so everything would be housed together and not on users pc) this script runs a query converts to xml, opens FTP and uploads the query along with .pdfs to the internet.

I can get it to work from home, no problem. I can get it to work from my pc at work.

But when I try on other pcs it can not find the db (error msg) or opened by another user in exclusive mode, yes I explored this option I dont think this it. 1) Cause the frontend can see the backend and everything works from there. 2) That pc is the only one with an open frontend. 3) When I try opening the actual db from the networked shared folder I get an unsafe expressions alert and can not open. The VB needs to open pull from the 2nd db. Both the backend and 2nd db I get this message.

Can anyone tell me how I can change this, the msg box says its out of trusted network. So I copied and actually opened on local pc, I could open it. Move it back to server and no such luck.

Thanks for any posts, I am having to get this working before I load for other branch offices.

I have googled and searched forum, seems everything is geared towards "sandbox".

View 4 Replies View Related

Looking Up Calculation Expressions In Table

Feb 22, 2006

First off, I am not sure if this belongs in the queries forum but it seems most of the question is geared towards a table so I have posted it here.

At the moment I have a query that contains several fields that use nested IIf statements to determine which set of rules to apply. I was wondering if it is possible to somehow set the IIf variables up in a table and then for just to lookup the table in the query.

For example, one of my simpler IIf's looks like this...

Cost:
IIf([AType]='Skill',
IIf([StartDate]<#01/08/2004#,
IIf([AOP]>0,
([BasicRate]-[Frame])/[AOP]/100*[Proportion]),
([BasicRate]-[Frame])/[OP]/100*[Proportion]),
([BasicRate]-[Frame])/[OP]/100*[Proportion])


So I was thinking could I setup a table to show:


FieldName AType StartDate AOP Calculation
Cost Skill <#01/08/2004# >0 ([BasicRate]-[Frame])/[AOP]/100*[Proportion])
Cost <>Skill Is Not Null Null ([BasicRate]-[Frame])/[OP]/100*[Proportion])


and then somehow perform the calculation rather than just look it up.

The main reason is it would be so much easier to see what is being calculated rather than try and weed my way through nested IIf statements.

Can anyone shed any light on this or maybe even a better way to accomplish what I am after?

View 1 Replies View Related

Query Calculation Expressions

Nov 28, 2005

Is there a way or what is the expression used if I want to do a running total in a query under a field called "Amount Donated". In addition, I would like to filter by selection using the DonorID as the primary key to show the total.

Thanks.

View 1 Replies View Related







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