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

RowSource for Combobox using max function

Dear bytes community,

FrameWork:
I have a table with the following fields: Id, Name, InterventionNumber, CheckPoint, Completed
In a form, I have a combobox that I want to populate with the entries that are obtained using the following criteria:
-First: check the maximum InterventionNumber for each unique Name;
-Second: filter the results of the first operation using the Completed field (it is a checkbox) equals True

Code Used:
Expand|Select|Wrap|Line Numbers
  1. Dim qry as String
  2. qry = "Select Id, Name, Max(InterventionNumber) From [table]" & "Where Completed = True " & "Group by Id, Name"
  3. Combobox.RowSource = qry
Problem:
Max function does not work because Id is always different (autonumber) despite the field "Name" possible repetitions.

Question:
How can I apply the filter just taking into account the Name and InterventionNumbers fields but being able to put all the fields that I want in the Combobox.

Thank you very much for your help.

Best regards,
Simão
Sep 5 '17 #1
1 2712
If I understand this correctly, you are trying to create a list of latest completed interventions for each name.

Instead of trying to use the MAX function with associated auto ID problems, try this approach.

1. Read each line in turn, complete with row number.
2. If the check is not completed, discard the line.
3. If the check is True
3a Use the 'name' field to compare with any existing entry.
3b If the name is not listed, add the line
3c If the name already exists, compare intervention number
3d If the number is greater than the existing one, replace it.

Your combo will be then filled with the latest intervention numbers for each name.
Sep 21 '17 #2

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

Similar topics

1
by: Mike | last post by:
In C, we can typedef pointer to functions, and therefore use function tables. But what's the advantage of using function table? Thanks, Mike
0
by: Hiroyuki Tanaka | last post by:
Hi All, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to...
2
by: Newbie | last post by:
Could someone help: I have been searching the web trying to figure out a way to use function key's in my vb.net 2003 program (No luck!). What I would like to do is enable the user to press (for...
16
by: agrawal.solutions | last post by:
Hello Friends I am asking a very silly question but i dont find any solution fo this.. I am selectiong a recordset and want to populate a combobox where id would be inviseble and the content...
3
by: drsantosh82 | last post by:
Hi, I am trying to implement a callback routine using function pointers. Basically, I am trying to avoid tying my callback invoking member to a particular class. Let me explain my problem...
6
by: x taol | last post by:
i want to change textbox to combobox type using vba. *** Sent via Developersdex http://www.developersdex.com ***
1
by: gourab103111 | last post by:
how get multiple values from combobox using php ,when i retrive value using $_POST
2
by: nikhizumi | last post by:
advantages of using FUNCTION in C++
1
by: shubham rastogi | last post by:
I am using a combobox.. and I want to display two columns combobox using the diplay member property...for example I have a table sam and it has two columns A and B . following are details of...
1
by: sharifsayyed | last post by:
<xml> <beneficiary> <District name="Nandurbar"> <Taluka>Nandurbar</Taluka> <Taluka>Nawapur</Taluka> <Taluka>Akkalkuva</Taluka> </District> <District name="Dhule"> ...
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: 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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.