Queries That Extract Repeated Item

Nov 14, 2007

I'm trying to set up a query where it returns me only the items that are repeated.

ie...I have a table that has clients that are one time clients and other that are repeated. Each client has a client number. I would like to get only the clients whose client number appears more than once. Is that possible?

View Replies


ADVERTISEMENT

SetFocus Problem With Repeated Item

Aug 17, 2006

I have a form that simply lists the items:
DEPARTMENT_NBR and DEPARTMENT_NAME

In the table: DEPARTMENT_TBL

When I edit the field DEPARTMENT_NBR and it is in error (must be between 01 and 99) I want to put out a message in a MSGBOX and SetFocus back on the DEPARTMENT_NBR.

I coded the MSGBOX with vbokonly and then DEPARTMENT_NBR.SetFocus, but after the message displays and enter is hit for the ok the cursor jumps to the DEPARTMENT_NAME on the current line. Is there a way to get the SetFocus to work properly on repeating items like this? I can never seem to get them to perform the same as they do on non-repeating items.

Thanks for your help.

HERE'S THE EXACT CODE:
If IsNumeric(DEPARTMENT_NBR) = False Then
If DEPARTMENT_NBR <> "00" Then
MsgBox "DEPARTMENT NUMBER must between 01 and 99.", vbOKOnly
DEPARTMENT_NBR.SetFocus
GoTo DEPARTMENT_NBR_EXIT
End If
End If

Also, is there a way to look at a specific item in a list like that? IE. I want to reference the 3rd row's DEPARTMENT_NBR. Thanks.

View 2 Replies View Related

Repeated Queries And Updated Data

Sep 13, 2013

I am running repeated calculation queries of different data, but its is not working to well. I have one query listing the total number of hats made from wool. I then have a second query of that lists the total number of hats made from wool and are black. I have third query that calculates the percentage. I have many different hats of many different colors, and i am doing the same three queries over and over. However, the calculated field for percentages does not update. E.G. I have 100 wool hats, 10 wool,black hats, 10%. The next round: i have 100 wool hats, 5 wool green hats, its will still show me 10%, as its is still calculating based on the previous data. how can i go about this most efficiently and why is not updating?

View 1 Replies View Related

Queries :: Counting Records Returning Load Of Lines Of Repeated Data?

Oct 11, 2014

I have created a query that is designed to return a count of how many records there are in various tables. There are 10 expressions in all, so when it is run I am expecting to see one row of data with each field populated with the number of records.

It does do this, but the data is repeated over line after line (see the attached picture)

View 4 Replies View Related

Queries :: Extract Max Date And Time - How To Get Corresponding ID

Jan 2, 2014

I have a (simplified) table with

ID | Date | Time | machine | value
304 1-1-2014 06:00 115 0.54%
305 1-1-2014 06:00 111 0.56%
306 1-1-2014 07:00 111 0.52%
307 1-1-2014 07:00 115 0.53%
308 2-1-2014 07:00 111 0.56%
309 2-1-2014 07:00 115 0.58%
310 2-1-2014 06:00 111 0.54%
311 2-1-2014 08:00 115 0.53%

I try to find the ID corresponding to the maximum date+time grouped by Machine.
In this case I would like to find 311 (maximum date/time for machine 115) and 308 (maximum date/time for machine 111)

The way to extract the maximum date + time is not difficult

SELECT Max([Date]+[time]) AS datevalue, tbl_TexControl.Machine
FROM tbl_TexControl
GROUP BY tbl_TexControl.Machine;

But how do I get the corresponding ID? Not with Max([ID]) because then ID 310 is selected which is not the maximum of the time.

View 5 Replies View Related

Queries :: Extract Names From Full Name?

Dec 17, 2013

Model Full Name: "Jones, John P." (this was the one not in MS' examples)
Last Name Extract = Jones
lastN = IIf(InStr(1,[Model Full Name],",")=0,"",right([Model Full Name],len([Model Full Name] - (InStr(1,[Model Full Name],",")+2)))First Name Extract = John
firstN = IIf((InStr(1,[Model Full Name],",")+1)=InStrRev([Model Full Name]," "),Right([Model Full Name],Len([Model Full Name])-(InStr(1,[Model Full Name],",")+1)),Mid([Model Full Name],(InStr(1,[Model Full Name],",")+2),(InStrRev([Model Full Name]," ")-1)-(InStr(1,[Model Full Name],","))))

View 1 Replies View Related

Queries :: Extract Data From One Field To Another?

Jun 17, 2013

Full Name, Forename, Surname, Salutation. This data has been extracted from another database where the Surname field was not required but it is now. So i need to find a way to pull data from the salutation field into the surname field where salutation has data but surname is null. The next one when surname and salutation are null but full name has data i need to pull that across.

View 11 Replies View Related

Queries :: Run To Extract Some Values For Calculations

May 12, 2015

I have a query that I run to extract some values for calculations. Its run on an event based on a dropdown selection. At the moment, I run via:

Code:
DoCmd.OpenQuery "CallMidprice"

and then close it. this seems to take more time than is necessary when I only want to refresh the results.Open query without close, switches to the table but doesn't update until I press F5.When I try requery I get an error. "Runtime error '2109': There is no field named 'CallMidprice' in the current record.

Requery without 'Callprice' seems to requery my form.

View 5 Replies View Related

Queries :: Extract Text Between First And Second Character

Aug 30, 2013

i would like to make a query in ma access can extract text between first and second character "/" and when there are not "/" in field it returns null.now data in my table are like below

Quote:

No option1 1 100 2 145/Mechanical/0800 3 120/electrical/1620 4 131/mechanical/0200/dw-001

Now I like to make a query can extract text between first and second character "/" like below: No option1 discipline

Quote:

1 100 null 2 145/Mechanical/0800 Mechanical 3 120/electrical/1620 electrical 4 131/mechanical/0200/dw-001 mechanical

View 1 Replies View Related

Queries :: Extract 3 Numbers From A String

Jul 11, 2014

I am trying to extract the first instance of 3 numbers from a string using an update query to update another field in the same table(Master Equipment) titled "Code". the field is called "Equipment". the strings vary in length as well as the location of the 3 numbers needed, but I have examples of all possible locations the 3 number series could be located below. As you will notice, some fields do not contain 3 numbers together, for these I don't want to return a value.

07-FLP58351
07-MFDP58201
1PBE97601
1PT91105-2
2WPF/FF438582
A-WR-1
AAV58101-01
AC47201-01

View 13 Replies View Related

Queries :: Extract Day From The Date And Return A Value

Feb 20, 2014

I have a list of dates on which tasks were performed.

I want to be able to see if there is a pattern, i.e. lots done on a Monday

Can I extract the Day from the date, and return a value Monday, Tuesday, Wednesday etc??

View 3 Replies View Related

Queries :: Extract Text Between Certain Characters

May 14, 2014

I have a field that contains the following data:

FirstName:Pedro LastName:Campos Restaurant:BI Strand Location:North Month:March

I need to extract the data into different fields like this:

Field1: Pedro
Field2: Campos
Field3: BI Strand
Field4: North

How to extract the information I want into different fields

View 1 Replies View Related

Queries :: Extract One Record Per Unique ID

Feb 19, 2015

I have a table like so:

Code:
PatientID VisitDate Complaint TestPos
1 4/5/2003 Coughing 1
1 1/2/2007 Sneezing
1 5/1/2008 Unknown 1
2 2/1/1988 Unknown
2 4/2/1988 Unknown 1

I'd like to extract just one TestPos record (TestPos = 1) per Patient ID. And I always want to select the record with the earliest date. So the result would be:

Code:
PatientID VisitDate Complaint TestPos
1 4/5/2003 Coughing 1
2 4/2/1988 Unknown 1

I can do this but it requires 3 queries: a SELECT query where TestPos = 1, a GROUP BY PatientID query and MIN(VisitDate) to get the desired record per patient, and then another query that links the two so I can get the additional variables (e.g., Complaint).

Is there a way to do this without using 3 queries? Seems inefficient.

View 3 Replies View Related

Queries :: Extract Data From Query

Sep 15, 2013

I am trying to extract data from a query. Part of code when form loads, my questions is bold:

'query criteria
vOrgCode = Me.tOrgCode
'sql statement
strSQL = "Select tblMembers.tOrgCode, tblMembers.tGender, tblMembers.nMonthlyIncome, "
strSQL = strSQL & "tblMembers.nFarmSize, tblMembers.tPrimeCrop, tblMembers.nNoHills "
strSQL = strSQL & "From tblMembers Where tOrgCode = '" & vOrgCode & "'"

[code]...

i cannot build a simple query and save it as reference since the number of organizations may be 25 at the minimum. this is why i want to build it on the fly, so to speak.

View 3 Replies View Related

Queries :: Return / Extract Just Text From Field

Aug 5, 2013

I have a field which contains "01501 PRIKLJ. VRHNIKA - LJ / Stevno mesto" .

1.) I would like to extract just text part from that field, how? *number is always on beginning but different 1-10000

2.) Optional, how could I delete in this new only text field part of text after / ...*some rows have some dont /

View 1 Replies View Related

Queries :: Extract Data Between Two Consecutive Comma Set

Jun 16, 2013

102,34112,021502503130010010000,QAR,1,24,1,{NULL:0 },{5:Y},6,14.5,31-MAR-2011

Above data is in one field , i want and expression to extract the data between two consecutive comma set by specifying the comma range.

For example if i specify range 2 to 3 then formula should return "021502503130010010000"

View 14 Replies View Related

Queries :: Extract PostCode Values From The Field

Feb 4, 2014

I have a table with a string field included for an address.

Some rows have postcodes and some dont

How can I extract the PostCode values from the field?

View 14 Replies View Related

Queries :: Truncate And Extract Value In String - Delimiter?

Apr 14, 2014

In Access 2007, in a table “Source” -> "UserName" column, I'm trying to truncate and extract value in the string:

a. Value within the parenthesis preceded by "".
b. Value outside the parenthesis preceded by “”

“Source” table contains the column ‘UserName’
“Final” table contains the columns ‘UserName’, “Expected_Output_1” and “Expected_Output_2”.

I tried using the following expressions to extract the output results, but unfortunately there’re not displaying the results in correct format.

For extracting results of “Expected_Output_1” I used: Mid([UserName],InStrRev([UserName],"")+1)

For extracting results of “Expected_Output_2” I used:

Mid(Mid([UserName],InStr([UserName],"(")+1,InStr([UserName],")")-InStr([UserName],"(")-1),InStrRev(Mid([UserName],InStr([UserName],"(")+1,InStr([UserName],")")-InStr([UserName],"(")-1),"")+1)

Attaching the database for your reference.

Expected results should match the snapshot attached or table “Final” in the attached DB

Example:
UserName = C103E000001 then the “Expected_Output_1” = E000001, “Expected_Output_2” = nothing

UserName = NAHoM\_INTRA_MTS (NAHoMDNAGAIntranetAdmin) then the “Expected_Output_1” = _INTRA_MTS, “Expected_Output_2” = DNAGAIntranetAdmin

View 1 Replies View Related

Extract / Count And Report From Multiple Queries?

May 20, 2013

I have set up a table for statistical information of students from our 8 campuses (campus, student first name last name, dob, parent info, grade, etc.). I have a query set-up for each campus.

I also have an excel spreadsheet when a student enrolls I change the number of students from each campus that are in grades 1-3, 4-6, 7-8 and 9-12.

Since I have already entered this information into my Access DB, I am wondering why do double-duty (thereby risking my forgetfulness) when I should be able to extract that information from these queries? Not sure how to do this in this grouping, per campus, giving a total count for each campus.

View 1 Replies View Related

Queries :: Extract Day Of Week From A Date To Link To Data

Dec 8, 2014

I want to use the expression Date() in a query to get today's date and then format this to "ddd" to give me the day of the week.

I then want to link this "ddd" to data in my table that contains the three letter days of the week.

How do I make the day become "static" in order to be able to link.

View 6 Replies View Related

Queries :: Difference Between Rows - How To Extract CHANGED Value In A Column

Jan 24, 2015

I have a query question . How can I extract a CHANGED value" in a column? Example here under table1. Time and TAG makes a record unique, No ID available ...

Table1
time tag value
10:02 Tag1 10
10:02 Tag2 11
10:03 Tag1 10
10:03 Tag2 11
10:04 Tag1 10
10:04 Tag2 12
10:05 Tag1 10
10:05 Tag2 12
10:06 Tag1 10
10:06 Tag2 12
10:07 Tag1 11
10:07 Tag2 12
10:08 Tag1 11
10:08 Tag2 11

I want to have as output
10:04 Tag2 12
10:07 Tag1 11
10:08 Tag2 11
(so at 10:04 tag 2 changed in value and on 10:07 tag1 changed value and 10:08 changed Tag2)

Preferably with the previous value as well, but this is not the highest prio
10:04 Tag2 12 11
10:07 Tag1 11 10
10:08 Tag2 11 12

View 2 Replies View Related

Queries :: Extract Data From Memo Field And Put Into New Table

May 13, 2014

Is there a way I can take each entry in a memo field and put it into a text field in a separate table. The database is getting really big and the customer notes field for each record has lots of entries. The memo field looks like this:

8.4.14 Ordered 2 cartons
20.3.14 Ordered 2 cartons
4.3.14 Ordered 2 cartons
18.2.14 ordered 1 carton
30.1.14 ordered 3 cartons SCENTED wipes

[Code]...

I want to take each line and put put the date in a date field and the text in a text field in a separate table linked by CustID. Is there a way to do that?

View 7 Replies View Related

Queries :: Extract Top 5 Vendors By TOTAL Spend By Group

Aug 7, 2015

I am having trouble extracting top 5 vendor with the sumOfSpend (actual Field name is Spend which is dis-aggregated) for each of 5 groups. Each group has thousands of transactions for dozens of vendors. The Table is designed as follow.

Table1:
GroupName : Text
VendorName : Text
Spend : Currency.

View 3 Replies View Related

Queries :: Stripping Letters From A String To Extract Information

Feb 15, 2015

I have a need to strip of letters from a string but i needs to look for / as the length would change, below is an example of the data I am working with

record 1 example ) REP/1349/999/426066/XX/9
record 2 example ) REP/UDKBS01N/1/448174/XX/

what i need to extract is

1) = 1349
2) = UDKBS01N

I need to get the information between the first / and the second / is there a function in access to get this.

View 5 Replies View Related

Queries :: Extract Or Calculate Number Of Records In A Sequence

Jan 4, 2014

How to extract or calculate the number of records in a sequence - e.g. in a table/query ordered by ID and date, the number of consecutive records by date for a given ID that have a value >= 50 in a given field. Is there a way of doing this purely within a query, or would I have to resort to a VBA loop through a recordset and keep a count of the consecutive records that match that criteria?

View 3 Replies View Related

Queries :: Using Query To Extract Data Based On Numbers

Feb 18, 2014

I have a table with a field named BinNo which has a list of items with a bin no in the format 1.234( this number can be any number up to 6000.9999).

Is there a way for me to have a field on a form where I enter a number (i.e 1) and it lists all the items with a 1 before the decimal point but not 10 or an other number with a one in it. If I enter 10 then it will only give me the items with 10 before the decimal point and not 11 etc.

I have a query that pulls all the data into it but I only want the query to show the items relating to the number I enter into the form field.

View 2 Replies View Related







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