473,407 Members | 2,306 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,407 software developers and data experts.

Multiple criteria access query

Hi
I want to make an expression to find out the value of a field particular employee of previous month, and i have put the following expression for it
prevdays:
Expand|Select|Wrap|Line Numbers
  1. DLookUp("[Plus_days_cf]","[ATTENDANCE]","[Emp_code]='" & [ATTENDANCE]![Emp_code] & "'" And "[Month_id]=" & (([ATTENDANCE]![Month_id])-1))
the criteria i have put give work individually but when i combine them it does not work properly. Please help.
Thanks in advance.
Nov 4 '11 #1
4 2758
jimatqsi
1,271 Expert 1GB
Pramod,
I'm sorry, but "it does not work properly." tells next to nothing about the problem you are encountering. What do you mean by that? What is the specific problem with the result you are getting?

What do you mean by "the criteria i have put give work individually but when i combine them" ... do you mean if you use only Emp_code in the criteria it works,and only "Month_id" in the criteria work okay but using both do not work?

Jim
Nov 4 '11 #2
hi
I mean to say that when i use the month criteria it show the value for that month but for all employees even(although that not i desire, but half work done), when i use the employee code criteria the value is shown for that employee but in every month. I want to find the value of a particular employee in the last month so i use both the criteria together but then it shows the first value in the table for all the employees in every month. I hope I explained properly.
Please help.
Thanks.
Pramod.
Nov 6 '11 #3
i have a table for attendance, in it in a particular month several employees, then in next month and so on. i want a particular fields value to be shown when the criteria matches which if the employee id is same and month id is one less than current, that is previous month.
how to do it, i used the above expression and that returns the value of the first record for all the months and all the employees.
Thanks
Pramod.
Nov 6 '11 #4
NeoPa
32,556 Expert Mod 16PB
This wouldn't have been such a mess if you'd posted the question properly in the first place Pramod. It would have been much clearer to everyone that you just mucked up your strings. Try instead :

Expand|Select|Wrap|Line Numbers
  1. DLookUp("[Plus_days_cf]","[ATTENDANCE]","[Emp_code]='" & [ATTENDANCE]![Emp_code] & "' And [Month_id]=" & [ATTENDANCE]![Month_id]-1)
Nov 11 '11 #5

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

Similar topics

4
by: ShyGuy | last post by:
I have a table with 4 fields. Three are used for criteria. I can get the DLookup to work with 1 criteria with the following but can't get it to work with 2 or three. NumofAppts = DLookup("",...
2
by: dskillingstad | last post by:
I'm trying to set up a parameter query based on an unbound form. This search form has about 5 text boxes where the user can type in values within each box and search a specific table based on the...
4
by: ShastriX | last post by:
Getting a weird error while trying out a query from Access 2003 on a SQL Server 2005 table. Want to compute the amount of leave taken by an emp during the year. Since an emp might be off for...
5
by: redstamp | last post by:
Try as I might I cannot find a way to write an access query to return a result set with the records from my database WITHOUT a certain set of values within a field. To explain, I have a table of...
4
by: JHNielson | last post by:
I have a query that I'm trying to update with a dlookup with multiple criteria This is the string: EVNT_DT: DLookUp("","","( .EVNT_QTR=.) & (.=.)") When i run it it says it can't find the...
6
by: Matsam | last post by:
Hi, I am using ADODB connection in ASP and want to run a select query depending on a runtime criteria. But its not working and giving error "Too few parameters. Expected 1." But the same thing is...
2
by: dlajeune | last post by:
I have a VBA script that returns a value (such as "ON" or "BC" or "AB"). I would like to add that value as the criteria in my Access query. The work flow within VBA is Get values from form's...
2
by: jboisa | last post by:
I've created a query to select voter registration records on a variety of criteria (all voters under 40 living in my city of a particular political party and who have voted in no more than 3 of the...
8
by: dakota1606 | last post by:
In a MS Access query it's straight forward when you want to return record number 100 as in: SELECT * FROM Depreciation WHERE (((Depreciation.ID)=300)); Is it possible, in this instance of the...
5
by: sh55555 | last post by:
I have built a query in Access using the DateSerial function to convert dates such as 20100401 to 04/01/2010. The query results work fine and the date is displayed correctly. I am now trying to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.