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

Help with DCount/DLookup

I am still working on my database of work performance for the company
I work for. I have a form (frmtblOccurrences) based on a table
(tblOccurrences). I also have tblAgent that contains personal info on
each agent (e.g., their ID number, hire date, etc.

The results for each occurrence are sequential: coaching, oral
warning, written warning, final warning, termination

The results are entered into frmtblOccurrences whenever there is an
occurrence.

What I want is a msgbox, after the agent's name is entered (via a
combo box) that says "The next result level is ... (the result level
one higher than where they were)

I also have a results table which is the source for the combobox on
the form where the results are entered. I don't need for the program
to set the combobox to the next level.

So, in English, when an agent's name is entered (pulled down from
combobox) , and the most recent result was "oral warning" i want the
msgbox to display "The next result level is written warning." The
user will then set the results field on the form to written warning.

Again, I'm new to this, I can do a little bit in VBA, I don't
understand recordsets and how to use them at all.

Any help is appreciated!

Isaac

Jun 15 '07 #1
2 2796
DLookup() is rather limited: you cannot specify the order of the records. It
just returns the first match it finds. Since you need to define "which is
the next record", you may be able to use this extended replacement called
ELookup():
http://allenbrowne.com/ser-42.html

An alternative approach might be to use a subquery to get the desired value.
If subqueries are new, see:
http://allenbrowne.com/subquery-01.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Isaac" <im***@sio.midco.netwrote in message
news:11*********************@a26g2000pre.googlegro ups.com...
>I am still working on my database of work performance for the company
I work for. I have a form (frmtblOccurrences) based on a table
(tblOccurrences). I also have tblAgent that contains personal info on
each agent (e.g., their ID number, hire date, etc.

The results for each occurrence are sequential: coaching, oral
warning, written warning, final warning, termination

The results are entered into frmtblOccurrences whenever there is an
occurrence.

What I want is a msgbox, after the agent's name is entered (via a
combo box) that says "The next result level is ... (the result level
one higher than where they were)

I also have a results table which is the source for the combobox on
the form where the results are entered. I don't need for the program
to set the combobox to the next level.

So, in English, when an agent's name is entered (pulled down from
combobox) , and the most recent result was "oral warning" i want the
msgbox to display "The next result level is written warning." The
user will then set the results field on the form to written warning.

Again, I'm new to this, I can do a little bit in VBA, I don't
understand recordsets and how to use them at all.

Any help is appreciated!

Isaac
Jun 15 '07 #2
You want something like
NextLevel = DMin("WarningLevelKey", "WarningLevels","WarningLevelKey>" &
CurrentWanringLevel)
If Not(IsNull(NextLevel) then
NextLevelMessage = DLookup("WarningLevelMessage", "WarningLevels",
"WarningLevelKey=" & NextLevel"
Else
NextLevelMessage = "No Higher Level"
EndIf
Msgbox NextLevelMessage

Hope this helps,

Gary

"Isaac" <im***@sio.midco.netwrote in message
news:11*********************@a26g2000pre.googlegro ups.com...
>I am still working on my database of work performance for the company
I work for. I have a form (frmtblOccurrences) based on a table
(tblOccurrences). I also have tblAgent that contains personal info on
each agent (e.g., their ID number, hire date, etc.

The results for each occurrence are sequential: coaching, oral
warning, written warning, final warning, termination

The results are entered into frmtblOccurrences whenever there is an
occurrence.

What I want is a msgbox, after the agent's name is entered (via a
combo box) that says "The next result level is ... (the result level
one higher than where they were)

I also have a results table which is the source for the combobox on
the form where the results are entered. I don't need for the program
to set the combobox to the next level.

So, in English, when an agent's name is entered (pulled down from
combobox) , and the most recent result was "oral warning" i want the
msgbox to display "The next result level is written warning." The
user will then set the results field on the form to written warning.

Again, I'm new to this, I can do a little bit in VBA, I don't
understand recordsets and how to use them at all.

Any help is appreciated!

Isaac

Jun 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Norman Fritag | last post by:
Hi there, I am wonder why this dlookups return null, despite having a record in the table with a matching date? Am I missing something here??? Am i running in some limitations, that I am not...
11
by: WindAndWaves | last post by:
Hi everyone, I hope I will not get banned for asking toooo many questions. I am just really excited to have this platform ;-) I have the following function: Function IsProperty(pptname) as...
3
by: Alec | last post by:
Hi All, I am trying to use the DCount and DLookup functions with the WHERE expression set to: "DateToDo <= #" & Date & "#" to display all items with their DateToDo set to the current date or...
1
by: kaosyeti | last post by:
so i'm new to access but i've done a lot in the last 3 months since i looked at it for the first time back then. so when i finished my first db for my job, i cut it close to the end of the year...
7
by: MLH | last post by:
?dcount("","qryOwnrsDueITSwMissingAddr") when run in the immediate window return a number greater than the number of rows that display when the saved query is run - opening in the database window?...
1
by: Sheldon Mopes | last post by:
I have read a few articles that state that a multi-user app over a network will run faster if DSum & DCount functions are replaced with SQL statements replicating the functions. As I am a novice to...
2
MGrowneyARSI
by: MGrowneyARSI | last post by:
Hello I'm trying to do a dcount in a Query where a boolean, Yes/No field is set to true but I keep geting the msg. Data type mismatch in critiria expression here in the count If DCount("",...
8
by: Susan Bricker | last post by:
I have used DCount() to determine the number of records in a recordset. Silly me ... I just noticed that DCount returns an INTEGER, which can hold a maximum value of 32,767. What if the recordset...
2
by: David | last post by:
Dear All I'm trying to use a multi-select listbox as criteria to either add new record or edit the current record of the destiantation table with each row selected in the box. This works fine...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.