Hello, I have a question. I don't really know much about access, but I am really comforatable with SQL (DB2 and MySQL Programmer). Anyways, I was wondering if there is any way to do the following in SQL.
I have a Students Table that holds the names of students, an applications table that holds different applications, and an offers table that holds offers for the different applications.
The relationships for the tables are :
One Student Has Many Applications, One Application has Many Offers
IE: One Application can have up to three offers attached to it. I have the following query running to get all of the offers for all students in a specified term:
SELECT DISTINCT Offers.tblStudentProgCodeFK, Names.StudentID, Names.FName, Names.LName, (Offers.Code), tblPrograms.ProgName, Names.[Country Of Birth], Offers.[OCAS Number]
FROM qryApplications_Offers AS Offers, [Names], tblPrograms, (SELECT DISTINCT StartingDate, EndingDate FROM StartDates WHERE Term LIKE "*"+[Forms]![frmSelector]![Term]+"*") AS B
WHERE (Names.StudentID = Offers.StudentID AND (tblPrograms.ProgCode = Offers.Code OR Offers.Code=0) )
(Offers.StartDate BETWEEN B.StartingDate AND B.EndingDate);
What I was wondering is if there is any way to add a field in the output that would number the selections. Right now it returns a table like:
I have a form-subform structure and my aim is to number certain records of the subform. These records would contain value: 1,2,... And when changing the record on the main form, the subform's record should have the values 1,2,... again. (These values are shown on the bottom of the subform, where we can step the subform's record.)
If I use an autonumber field, the numbering goes continously.
I have a table with 3500 records with following fields : Id_number, Num , Name , Address,.
This table used for store customer data .
My job is print 10 record randomly by customer arrival . I made this by use num field and put number manually, example I put 1 ,2 , 3 .... Till 10 , so for print i made criteria , I put 1 and 10 . Problem is because more and more customer is coming , I got confuse to put number manually . are there any way to get it automatic ?
I've received a database that is a digitized population register from the 19th century. All adults have been entered into the database, but all children are missing.
Every person has a unique number that corresponds with the original source (this variable is called 'no', this is not the autonumber primary key thing). Instead of searching in the original source which numbers are still missing, I would like to add the missing numbers (with no additional information, because I still need to type that in).
For example, the table now looks like this:
no - name_last - name_first - occupation etc
1 Smith Henry baker 2 Smith Mary 5 Williams John butcher 6 and so on
So 3 and 4 are missing.
How can I add these missing numbers automatically?
I would like to create an expression that would number each item in sequential order in a query . I cannot use autonumber on the table because I am pulling it from SQL and do not have clearance to change the actual tables. I have been searching through this forum for the last 2 hours and have not come across anything similar to this, so I hope I'm not covering a topic that has already been covered.
I need to generate line numbers for an access query. This query is run via VB code. After it runs, a Dlookup is performed to search for the line number of a particular order detail id. When it finds it, it puts the line number along with other unique order detail information into a text file to be used by a computerized saw that cuts the parts out. Here's a sample query:
The query is supposed to be sorted with SortID Descending, Frmlgth Ascending, Stilelgth Ascending - in that order. The sort is working fine. However, the Sequential numbering is not. The OrderdetailID has NO bearing on the sort order. Here is my SQL code:
SELECT OrderDetails.OrderDetailID, ProductTypes.ProductTypeSortOrder, OrderDetails.FrameStileLengthActual, OrderDetails.FrameRailLengthActual, OrderDetails.OrderID, (SELECT count(*) FROM OrderDetails As x WHERE x.orderdetailid <= OrderDetails.orderdetailid AND x.orderid = orderdetails.orderid) AS SeqNo FROM OrderDetails INNER JOIN ProductTypes ON OrderDetails.ProductType = ProductTypes.ProductType GROUP BY OrderDetails.OrderDetailID, ProductTypes.ProductTypeSortOrder, OrderDetails.FrameStileLengthActual, OrderDetails.FrameRailLengthActual, OrderDetails.OrderID HAVING (((OrderDetails.OrderID)=[forms]![orders]![orderid])) ORDER BY ProductTypes.ProductTypeSortOrder, OrderDetails.FrameStileLengthActual DESC , OrderDetails.FrameRailLengthActual DESC;
Does anyone have any suggestions? I'm not too good with SQL, but I can figure it out (I think!). I've searched all the formus, but all the reference I can find regarding this don't work for me in my application...
I have a query on a timer that basically looks at a linked table every minute and tells me whose in the database. I want to number the rows in a column so I can reference this to a form that has 7 spaces. The number of 'users' could vary from 0 - 23, although this will soon be limited to 7 (hence the 7 spaces) to aid performance and speed. I am then going to reference the number to the unbound space on the form, iif(isnull()) 'ing the blank cells so it isnt an error.
I thought of an append query, but the sequence will always start at the next number, not from 1 each time - or as far as im aware it will - so I cant reference the cell then.
Just trying to figure out how I can run a select query on some data I have and how to also include an additional field which has a value counting the number of rows.... eg in the first row there would be the usual results and the new field would have a value of 10001, second row would be 10002, third would be 10003.
I've done some searches for sequential numbering but couldnt find anything so far.
I've taken on the task of transitioning excel reports (and their format) to a database. One report summarizes all the parts of a piece of furniture, and the order of the machines each part goes to.It looks similar to this:
Part# Part Name Machines/Operations M7264Top Panel 112114116120121325216 M7265Under Top Panel 112114116120121 M7266Base Assembly 411325216311310312316
The table this comes from has both operations and setups, so I used a query to filter only the operations.The query (qryOperations) result looks like this:
i need to add sequential numbering (1,2,3,4...) to each line of the qryOperations and use the sequential numbering as the column header.How do I add sequential numbers to the query, that restart after each change in part number? I can do this in a report easy enough, but not a query.This is the SQL of the query I need to have the sequential numbers in...
SELECT tblparts.[PART NUMBER], tblOperationCodes.MachineCode, tblOperationsList.Order FROM tblparts INNER JOIN (tblOperationsList INNER JOIN tblOperationCodes ON tblOperationsList.OperationCode = tblOperationCodes.OperationCode) ON tblparts.[PART NUMBER] = tblOperationsList.[PART#] WHERE (((tblOperationCodes.Function)="O")) ORDER BY tblparts.[PART NUMBER], tblOperationsList.Order;
I have a query that groups the data by customer. How can I create a "Transaction Number" field where I assign a sequential number to each invoice, starting at 1 with the oldest invoice and increasing the sequential number by 1 with each invoice. I need to create this field in a query without code.
I ran some code to number old records in a column to order items in a datasheet subform however after updating the column in the inventory transactions table when opening the main form that relies on it. It runs a query to determine the customers balance due and the query for that is taking forever to run like 2-3 minutes or more however reverting to an old copy of the data it runs fine and all I did was renumber records in one column most of which had 1s in them the code to re-number the records:
Code: Dim rst As DAO.Recordset Dim i As Long Dim OID As Long Dim stringSQL as String i = 1
I continued playing with this today and the query that is breaking the 2nd level subquery that actually references the inventory transactions table that I changed runs fine but go up a level to subquery1 which references subquery2 and a sum of payments query and it chokes however sum of payments only refernces the payments table.
I did some more testing today Subquery2 and sum of payments query both run faster than what I can time with a stopwatch but when combined they take approximately 1:45 there are only 5 columns in subquery1 four from subquery2 and 1 from the sum of payments 3 of the first 4 are sum and the last is group by and then the one from sum of payments is group by
Code: SELECT CLng((nz([UnitsSold])*nz([UnitPrice]))*(1-nz([Discount]))*100)/100 AS [Line Total], CLng([Line Total]*(1+nz([SalesTaxRate]))*100)/100 AS [Line Total With Tax], [Line Total With Tax]-[Line Total] AS [Line Tax], [Inventory Transactions].*
I have one main table containing most data, that table stores data which is identifies by a unique ID (currently 1-96000), there is also an issue number, I need another numbering system per issue (so you could have issue 166, record 26), any ideas?
Shall be grateful for clarifications for these two :
1. I have two fields - TheYear (set to take the current year) and another for sequential numbering. In fact I created this to replace the autonumber field. As suggested by a member I created a Generate button with the criteria as under
Private Sub Generate_Click() If IsNull(Me![NumFld]) Then Me![NumFld] = Format(Nz(DMax("[NumFld]", "[DiaryTable]", "[TheYear]='" & Year(Date) & "'"), 0) + 1, "00000") End If Me![NumFld] = Format([NumFld], "00000")
It works fine. and when the year is changed, the numbering starts from 1 again. My question is how do I make it to auto generate the number so that the user doesnt have to click the Generate button everytime to get the number. Suggestions please.
2. Is it possible to change this sequential numbering midway i.e. to start from a different number and increment by one?
We have a part numbering system that is currently like this, 11Y22 where 22 increments by one until it gets to 99 where it then goes back to 0, once it goes to 0 the letter increments to Z in this case, now once the last three characters get to Z99, then the 11 gets incremented eg, 11Z99 will become 12A00. Hope that is clear :)
My question is, can this system be implemented into the auto numbering in Access?:confused: