Exporting Records That Match One Or More Than One Column
Jan 12, 2015
I have stored data in access. The records have name, address and unique Id. I want to be able to extract the unique ID from the Access database for all those records that match the name and address in any new file that I compare my Database with.
View Replies
ADVERTISEMENT
Jun 12, 2015
I am using access 2010. I have "classlevel" table with 2 columns-Class and Value1 .Value1 column has numeric values that i ll input from webpage (webpage to ms access connectivity).I want to sum the values of column "Value1" and i have another table-"Volume" which has 2 columns "VolumeLevel" and "Value2". So i want to match the sum that i calculated from first table-"ClassLevel" with the "value2" column in "Volume" table and get the corresponding "volumelevel" column value from that table and there is a third table that will get this volumelevel value.
There is no common column to join these tables.
Classlevel-
Class Value1
Class 0 3000
Class 1 2000
Class 2 300
Class 3 400
Class 4 500
Volume-
Volumnlevel Value2
Vo 0
V1 5000
V2 10000
V3 30000
....upto V10
View 1 Replies
View Related
Apr 2, 2014
I have parent-child one to many data in one pair of relationships, and now I've been asked to see be able to find out what matches a defined regimen; each is also defined in a parent-child relationship.
Best is to show sample data. I'm going to show them as two tables, but the "Components" are actually in a parent-child relationship, e.g.,
PersonList -= Meds
Regimen -= Meds as well
Note that PersonList and Regimen do not really have any relation; we just want to see if things are being done one of the ways they are "supposed" to be done, without a slow manual check. It's worked as set up for reports, and I really don't want to change everything to a big long list of fields, one field per med for a lot of reasons (not least of which is that is denormalizing)
Quy 1 Result:
PersList T1Component
Andrew Med 1
Andrew Med 2
Brett Med 1
Brett Med 3
Brett Med 4
Charles Med 2
Duane Med 1
Duane Med 4
Quy 2 Result
Regimen T2Component
Goody1 Med 1
Goody1 Med 3
Goody1 Med 4
Goody2 Med 1
Goody2 Med 2
I'd like to be able to do two queries - one that are "OK" one that are not. Don't need to replicate the med list, just the regimen if matching..
"Good" would return
Person Regimen
Andrew Goody2 (he has med 1, 3, and 4)
Brett Goody1 (he has med 1 and 2)
"Bad" would return
Person
Charles
Duane
What they "almost match" does not matter; it tells people which ones we need to check into a bit more.
View 4 Replies
View Related
Jun 12, 2015
I am using access 2010. I have "classlevel" table with 2 columns-Class and Value1 .Value1 column has numeric values that i ll input from webpage (webpage to ms access connectivity).
I want to sum the values of column "Value1" and i have another table-"Volume" which has 2 columns "VolumeLevel" and "Value2". So i want to match the sum that i calculated from first table-"ClassLevel" with the "value2" column in "Volume" table and get the corresponding "volumelevel" column value from that table and there is a third table that will get this volumelevel value.
There is no common column to join these tables.
Classlevel-
Class Value1
Class 0 3000
Class 1 2000
Class 2 300
Class 3 400
Class 4 500
Volume-
Volumnlevel Value2
Vo 0
V1 5000
V2 10000
V3 30000
....upto V10
Answer that i am looking for is V1 as sum=6200 lies between 5000 and 10000 so its V1.
Table 3-
Volume-
V1
View 14 Replies
View Related
Oct 12, 2013
How to find an exact match in a Access DB table using Sql Query in VB6 ?I know that "Like" keyword will give out all those rows which contain the search-for-string. But I want exact match.
View 4 Replies
View Related
Mar 19, 2015
I've set the column widths properly on the subform, but the down arrow on the list box is still outside of the selection area. It may have something to do with lookups or concatenations, but I'm not finding that so in what I can think of to trace down.
I exaggerated the width of the list box to show where the down arrow actually shows itself.
See the form "frm_Class_Skills_Update" in the attached database. I need it to be visible when the list box is about 1.25" more narrow.
View 2 Replies
View Related
Feb 12, 2008
I have an Access table say Tbl_People that looks like :
ID1-ID2-Name-Age-Location
xxx-yyy-Mike-25-Essex
uuu-vvv-Jack-32-Surrey
mmm-nnn-Bob-36-Newcastle
I want to transfer this data into another table say Tbl_Output with four columns in the format below:
xxx-yyy-Name-Mike
xxx-yyy-Age-25
xxx-yyy-Location-Essex
uuu-vvv-Name-Jack
uuu-vvv-Age-32
uuu-vvv-Location-Surrey
mmm-nnn-Name-Bob
mmm-nnn-Age-36
mmm-nnn-Location-Newcastle
In Tbl_Output's 3rd column, only the Columns names: Name, Age and Location are repeated for each person and not column names ID1,ID2 (only its data xxx,yyy etc. is required in columns 1 and 2 as shown).
I was helped by rpeare with a VBA module that gives a single column output in Tbl_Output as
Mike
25
Essex
Jack
32
Surrey
Bob
36
Newcastle
The code is:
Sub main()
Dim db As Database
Dim rstElements As Recordset
Dim sName As String
Dim sNumber As String
Dim sArea As String
Dim freefile
Dim Filenumber As Integer
Dim sSQL As String
Set db = CurrentDb
Set rstElements = db.OpenRecordset("tbl_elements")
rstElements.MoveFirst
sSQL = "DELETE * FROM Tbl_Output"
db.Execute sSQL
Do While rstElements.EOF <> True
sName = rstElements.Fields(1)
sNumber = rstElements.Fields(2)
sArea = rstElements.Fields(3)
sSQL = "INSERT INTO Tbl_Output (OutputField) SELECT '" & sName & "'"
db.Execute sSQL
sSQL = "INSERT INTO Tbl_Output (OutputField) SELECT '" & sNumber & "'"
db.Execute sSQL
sSQL = "INSERT INTO Tbl_Output (OutputField) Select '" & sArea & "'"
db.Execute sSQL
rstElements.MoveNext
Loop
Set rstElements = Nothing
Set db = Nothing
End Sub
How can this be modified to get the required format data above? Thanks for any help in advance
View 4 Replies
View Related
Dec 7, 2013
I would like to export from access a recordset into Excel and bold the column headers.
My current code works for the most part, except for the bolding.
You run the code in Access module and the code does the following:
1) checks to see if the excel file is open
2) if excel file not open, it opens the file, clears existing records, and starts copying and pasting new recordset into the RAW worksheet
3) it is then supposed to bold the column headers.
bolding is not working.
Code:
Sub TestFileOpened()
Dim lastRow As Long
' Test to see if the file is open.
If IsFileOpen("c: est2003.xls") Then
' Display a message stating the file in use.
MsgBox "File already in use!"
[code]....
View 1 Replies
View Related
Jan 10, 2014
I have a report in Access that produces variable headers as the output is different from client to client. When exporting to PDF everything works great but when exporting to Excel these variable headers are exported with their true names. Col8, Col9, Col10 etc. And our clients insist on Excel reports. Is there a way to get the assigned name to export to Excel? Assigned names would be something like Medical, Dental, Vision or whatever is applicable to the client and is assigned to the report through VBA code. BTW, the data for the report is pulled from a cross-tab query so exporting directly from the query has its own set of formatting issues and is the reason I am using a report with variable column headers.
View 2 Replies
View Related
Mar 29, 2007
Hello,
My database has two tables:
Master and History
Both tables have a SSN field with the following format:
000-00-0000XX (xx stand for two additional characters)
I have a search form with a textbox that I use to type criteria to open a form. The text box has the following SSN input mask: 000-00-0000CC;0;_
This allows me to return data even if I have a part of the SSN
I have now placed a button which verifies if the SSN I will type in the textbox already exists in table History. I am having problems with the SSN format as I have to type the whole SSN while I would like to type part of it (like the textbox input mask).
If Not IsNull(DLookup("[SSN]", "History", "[SSN] = '" & Me![txtbox] & "'")) Then
DoCmd.OpenForm ("popupssnsearch")
Is there a way I can do this?
THanks.
View 1 Replies
View Related
May 3, 2005
(this might be more appropriate in Forms; apologies if I'm putting it in the wrong place.)
My company runs a home repair program and we keep track of our clients in a database I made a few months ago. We use almost exclusively a form drawing from 3 tables. We just hit 800 records (according to the form) and I was checking some things, and found that there are 807 records in each of our 3 tables.
I did a preliminary check, and the primary keys match as best I can tell, so I'm trying to figure out how 7 records can be missing from our form.
Any ideas?
Thanks in advance.
will
View 3 Replies
View Related
May 20, 2015
I currently have a query that uses a function to get the current users email address. This is matched with a "Teacher Email" address in a table of students to only show students which match the logged in teacher. I'd like to modify this so the teacher can see any student in their department. Is there a way to do this without creating a separate "Teachers" table that would contain a department and email?
View 5 Replies
View Related
Nov 2, 2005
Hi, I have a personell DB an I vant do be able to select only the persons from a specific "city" with a specific " genre" and a specific "skill" and also i want the query to "ignore" one of the criteria if I press Enter or input all.
I tried with "query design " and I don't seem to make it work for more than one condition.
Thanks
View 2 Replies
View Related
Jan 25, 2006
I want to place a control in a report footer that will return the highest number of consecutive weeks that a profit was earned. The database has fields named WeekNo and Net. The Net field contains positive values (profit) and negative values (losses). The WeekNo field is an integer from 1 to 52 designating the week number.
For example if the figure in the Net field is a positive number I want the control to count the number of consecutive weeks that a profit was earned. I know how to get the value of total weeks that a profit was earned; this is not what I am looking for. The control must return the highest number of CONSECUTIVE weeks that a profit was earned over the year.
Any help would be appreciated.
View 1 Replies
View Related
Feb 14, 2014
I understand that a query can accept wildcards in the search criteria but this is different.
I have a form on which a user selects a [product] part number in an unbound combo e.g. "12345-V111".
I then need a subform on the form to list records where the relevant field matches the left most part of this part number but is not necessarily complete. e.g. records with "12345-V1" would be returned, records with "12345-V2" wouldn't. The number of characters recorded in this field will vary, but if the characters that are entered match, then the record should be listed.
In other words, the record entries themselves need to be treated like wildcard entries.
View 7 Replies
View Related
Oct 28, 2013
I have a db which has a query. This query is rather simple where it filters fields based on criteria. Here is the SQL VIEW:
SELECT DSResult.STATUS, DSResult.TESTCODE, DSResult.BATCHNO, DSResult.TESTNO, DSResult.TESTDATE, DSResult.CODE
FROM DSResult
WHERE (((DSResult.STATUS)="TESTED") AND ((DSResult.TESTCODE)="41015" Or (DSResult.TESTCODE)="41016") AND ((DSResult.BATCHNO)<>"1") AND ((DSResult.TESTDATE)>=#1/18/2010#))
ORDER BY DSResult.TESTCODE, DSResult.TESTDATE, DSResult.CODE;
I need to alter this query so that where records that have the same "DSResult.CODE" and counted are greater than 20 occurrences and then display only these records sorted in DSRESULT.Code order.
View 6 Replies
View Related
Jan 12, 2014
All seemed to be working well, however, I noticed that all my subtable records in the database are exporting with each Primary table record. In my output, I'm looking to see each primary table record followed by one or more subtable records from a one to many relationship.
(Office 2010) Access/Word
Private Sub cmdPrint1_Click()
Dim objWord As Word.Application
Dim docm As Word.Document
Dim db As DAO.Database
Dim rstLandSales As DAO.Recordset
[Code] ......
View 14 Replies
View Related
Jun 19, 2006
Very new to access, I need an easy way to compare 2 tables with a common field (the name field) and list just the records that appear in the second table but not the first (primary) table.
Please help, thanks.
View 3 Replies
View Related
Jan 23, 2012
I would like to create a query that will delete records that match several fields from another table. This is complicated by the fact that one of the fields will be in one of 3 columns.I have attached a test database (no real details), all Sheet2 entries need to be deleted from Sheet1.
What I need to do is delete records that have the same 'Surname' and 'DPS' value but also the same 'Line5' value from Sheet2 in 'Line3' or 'Line4' or 'Line5' in Sheet1.The 'Surname' and 'DPS' are no problem, it's the variable position of the third field. I think I could do it in three separate queries but it would definitely be better in one.
View 5 Replies
View Related
Mar 12, 2013
Using sql or access query I would like to create an expression that aggregates the first field and I would like to see all records grouped by the relationship with another field. Let me show an example.
My query shows:
field1 field2
apple a
apple b
banana a
carrot a
carrot b
dog b
elephant b
I would like my query to now display a third field and group field :
field1 field3
apple both
banana a
carrot both
dog b
elephant b
View 1 Replies
View Related
Sep 22, 2013
I have a sales sytem in Access 2010.New customers have to be imported to MYOB daily. I have a query that finds new customers and appends them to a table for importing at a later stage. I export the records in that table if the field "imported" is set to false. The results are exported to Excel so they can be imported into MYOB after some additional data is added. If there are no records to append to the import table I want to stop the export from happening. I am new to VBA and don't know how to express that the select query "000 Append New Customers...." should only run if the append query has records. If there are no records found, I want to put a message saying "no records found". Here is the code I have behind the command button:
Private Sub PrepCustcmd_Click()
'Turn warnings off
DoCmd.SetWarnings False
DoCmd.OpenQuery "000 Append New Customers to MYOB Customers", acViewNormal, acEdit
[code]....
View 2 Replies
View Related
Aug 2, 2005
I have been trying to figure out how to do this and the transferdatabase function wouldn't do what I needed. I have a table that has a bunch of records, each being a request for cad work somebody wants me to do. I change the status of each one to pending, working, or complete. Anyway I want to only keep the completed task records in the database for 90 days. After that the records will be exported to an archive database and purged from the working database. The problem I face is not getting the records I need “I used date stamps ;)” but getting the records I filtered to append the archive database table and not overwrite it. I made backups ;) of my db and am testing on those and cant figure this out. Below is the code I used to export. Like I said it overides the table rather than append...
DoCmd.TransferDatabase acExport, "Microsoft Access", _
"X:Archive.mdb", acTable, "tRequest", _
"tRequest"
MsgBox "its done"
Any ideas, pointers, stern words and a link to a post I missed, anything to help is appreciated. :o
Thanks,
Eric
View 1 Replies
View Related
Apr 26, 2006
I have a table set up as the following:
ssn account
01234567 1234567890
01234567 9876543210
01234567 7539514562
98765432 8765432109
98765432 9876541230
and so on...
I would like to create a query that will split the records up like this:
ssn account1 account2 account3
01234567 1234567890 9876543210 7539514562
98765432 8765432109 9876541230
and so on...
It can be in any format, either query or report, I just have to be able to export it into a text file in the same format. Does anyone have any ideas?
Thanks!
Vassago
View 11 Replies
View Related
Jun 24, 2005
Yes i'm having trouble with a Count problem, don't laugh at me.
I've got a query with 200000 plus records. Each record has an equipment ID number (its not the primary key) in column B. I just want to count up the number of records that have each equipment ID code, but im not sure how to do it.
Please help
View 2 Replies
View Related
Nov 2, 2005
Hi!
I have one column with text field
I would like to know how to cut for. example 2nd and 3 letter in records collected in this column?
Thanks in advance for any examples
View 1 Replies
View Related
Oct 4, 2006
I'm trying to delete just ONLY the records inside of the column, Not the whole ROW. But I just don't get it. This is what I used.
DoCmd.RunSql "DELETE tblMasterProfileSheet.QTY FROM tblMasterProfileSheet"
Everytime when I execute that script, it's deleting the whole row. I just want to delete records inside of the QTY column, not the ROW.
View 1 Replies
View Related