ORDER BY (alias) Not Working...
Nov 26, 2003
rsQuery.Open "SELECT colorDepth, COUNT(*) AS colorDepthCount FROM px_users GROUP BY colorDepth ORDER BY colorDepthCount, colorDepth", dcnDB, 1, 3
returns the following error:
No value given for one or more required parameters.
Is this just an Access thing, where it won't order by an alias?
View Replies
ADVERTISEMENT
May 10, 2007
Hello all,
Does anyone know (and would be willing to share) how one can order the results of a Union query in Access by something other than the returned values?
I have a simple Union query that would work perfectly - if I could get the thing to order the results in a particular order everytime:mad:. The query returns counts (all from one table) of separate select statements that each meet certain conditions (e.g. having state=Nevada, having state=California, etc.) as records - but since Union queries in Access order results in ascending or descending order by returned value, it puts my records in a different order every time the record values change. I need to have them ordered the same way (in the same order as they appear in the Union query, if possible) everytime so that I can return those values to specific cells in MS Excel. Any suggestions would be much appreciated!
View 3 Replies
View Related
Aug 28, 2007
Hi everyone,
On a form, I want to fix the tab order of the text boxes. So I go to the tab order property of the form and when it opens, it doesn't let me change the order. Can anyone help me on this?
Thank you very much
View 7 Replies
View Related
Oct 27, 2006
i have two forms - frmOne and frmTwo. frmOne opens frmTwo with this code:
intVar = Me!l_id
intRoom = Me!l_room
stDocName = "l_surveys"
stLinkCriteria = "[l_id]=" & "'" & intVar & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
on frmTwo i have the property for Order By set to "frmTwo.l_date DESC" but it never orders it by the date DESC....i've even tried to set it using VBA and i can't get it to work properly...
suggestions?
View 2 Replies
View Related
Jun 18, 2014
I have :
tblClient : Name, address
tblAgent: Name, address..
tblInsuranceCompanies: Name, Address.
&
Lets say :
tblCarOrders: OrderID, TransactionDate, ClientID, AgentID, CarMark, CarModel, PlateNumber, PaymentID,
tblOrderDetails: CarOrderID, CarPolicy, PolicyCodeNumber, ActiveDate, expiryDate
tblCarPolicy: CarPolicyID, PolicyDescrpt., InsuranceCompanyID, NetPremium
& also have : tbl Payment or methodPayment ..
If I have also HEALTH and EXPAT (servant) Policies that their details structure are completly different in Order and OrderDetails tables .
ex: tbl HealthOrder: OrderID, TransactionDate, ClientID, AgentID + DoB, and tblHealthPolicy: In, Out , etc And same is for Expat that is different also of Health and Cars Policy and Order..
How to make all the three ORDERS ( car , health and expat) working on one OrderId to make it easly for me when I am working on PAYMENT .Note that I am working on THREE different Order Forms here . and only Payment Table is the common in each Form..
View 2 Replies
View Related
Sep 25, 2007
so, I have created a working SQL statement that summarises data from a bunch of different tables (it's a stock monitoring application so it all has to do with levels of stock, numbers of parts processed etc...):
SELECT tblPPIn.BatchID,
tblPartDescriptions.DrawingNumber AS [Drawing Number],
tblOrder.IssueNumber AS [Issue Number],
tblPartDescriptions.Description AS [Description],
tblPPIn.Qty AS [Total Booked In],
IIf(IsNull((SELECT Sum(tblPPProcessed.QtyProcessed) AS SumOfQtyProcessed FROM tblPPProcessed WHERE tblPPProcessed.BatchID = tblPPIn.BatchID;)),'0',(SELECT Sum(tblPPProcessed.QtyProcessed) AS SumOfQtyProcessed FROM tblPPProcessed WHERE tblPPProcessed.BatchID = tblPPIn.BatchID;)) AS [Total Qty Processed],
IIf(IsNull((SELECT Sum(tblPPOut.Qty) As sumofQtyOutPass FROM tblPPOut WHERE tblPPOut.BatchID = tblPPIn.BatchID AND tblPPOut.IQCPass = 'PASS';)),'0',(SELECT Sum(tblPPOut.Qty) As sumofQtyOutPass FROM tblPPOut WHERE tblPPOut.BatchID = tblPPIn.BatchID AND tblPPOut.IQCPass = 'PASS';)) AS [Total Good Parts Taken],
IIf(IsNull((SELECT Sum(tblPPOut.Qty) As sumofQtyOutUninspected FROM tblPPOut WHERE tblPPOut.BatchID = tblPPIn.BatchID AND tblPPOut.IQCPass = 'UNINSPECTED';)),'0',(SELECT Sum(tblPPOut.Qty) As sumofQtyOutUninspected FROM tblPPOut WHERE tblPPOut.BatchID = tblPPIn.BatchID AND tblPPOut.IQCPass = 'UNINSPECTED';)) AS [Total Uninspected Parts Taken],
IIf(IsNull((SELECT Sum(tblPPProcessed.QtyPass) AS SumOfQtyPass FROM tblPPProcessed WHERE tblPPProcessed.BatchID = tblPPIn.BatchID;)),'0',(SELECT Sum(tblPPProcessed.QtyPass) AS SumOfQtyPass FROM tblPPProcessed WHERE tblPPProcessed.BatchID = tblPPIn.BatchID;)) AS [Total Passes],
IIf(IsNull((SELECT Sum(tblPPProcessed.QtyFailEtching) + Sum(tblPPProcessed.QtyFailCutOut) + Sum(tblPPProcessed.QtyFailFlatness) + Sum(tblPPProcessed.QtyFailHandling) + Sum(tblPPProcessed.QtyFailOther) AS SumofFails FROM tblPPProcessed WHERE tblPPProcessed.BatchID = tblPPIn.BatchID;)),'0',((SELECT Sum(tblPPProcessed.QtyFailEtching) + Sum(tblPPProcessed.QtyFailCutOut) + Sum(tblPPProcessed.QtyFailFlatness) + Sum(tblPPProcessed.QtyFailHandling) + Sum(tblPPProcessed.QtyFailOther) AS SumofFails FROM tblPPProcessed WHERE tblPPProcessed.BatchID = tblPPIn.BatchID;))) AS [Total Fails],
[Total Booked In]-[Total Qty Processed]-[Total Uninspected Parts Taken] AS [Total Unprocessed Parts Remaining],
[Total Passes]-[Total Good Parts Taken] AS [Total Good Parts Remaining],
[Total Passes]/[Total Qty Processed] AS [Overall Yield]
FROM tblPPIn INNER JOIN (tblPartDescriptions INNER JOIN tblOrder ON tblPartDescriptions.DrawingNumber = tblOrder.DrawingNumber) ON tblPPIn.BatchID = tblOrder.BatchID
ORDER BY tblPPIn.BatchID ASC;
don't worry about the details, it works as it is above...
now I only want to display data for batches where there are some parts left, so I've tried adding the following WHERE clause:
WHERE ([Total Good Parts Remaining] + [Total Unprocessed Parts Remaining]) <> 0
should work fine, right?
nope, we get the (all too familiar) 'Enter parameter value: Total Good Parts Remaining' (and the same for 'Total Unprocessed Parts Remaining'), despite the fact I have used these aliases in the previous SQL with no problem...
Is there any way around this or do I have to create a big-ass WHERE statement complete with the subqueries I've already used previously?
This is seriously annoying me today... any help would be massively appreciated!
cheers,
Bogzla
View 7 Replies
View Related
Sep 27, 2005
I am trying to use one Access 97 mdb file to attach to two different SQL servers depending on the situation, one is production the other is a backup server. (The application requires an Access97 file format so I can't change that) I have a DNS Alias for the server name and I put that in the ODBC under Server Name. When I have the Alias changed from Production to Backup I want the Access file to see the data on the backup box.
It appears that MSAccess stores the Server name when the link is made in the MSysObject.Connect field and it does not update that even, if the ODBC is changed. I have one test connection that seems to working because I created it using the ODBC after the Alias was added. The string it puts in the connect field has no reference to the server name or address similar to what is below.
DSN=A_C;Description=A Control;UID=username;APP=Microsoft® Access;WSID=PC22361;DATABASE=DACSP001;Trusted_Conn ection=Yes
The MSysObject.Connect in a file that did not use the Alias looks like this...
DSN=A_C;Description=A ;APP=Microsoft® Access;WSID=PC27368;DATABASE=DACSP001;Network=DBMS SOCN;Address=pmnt9511.sce.corp.com,1433
So I think I need to recreate a new file using the Alias in the ODBC so the specific address is not in the connection string. What do you think?
Has anyone used an Alias name like I am trying to switch between like databases on two different servers? It seems weird that in the first example above there is not reference to the alias name so maybe this forces it to look it up.
Thanks in advance...
View 1 Replies
View Related
Jun 20, 2013
I am writing a very complex 'if statement' query expression. I need to create an alias column based on data from two data fields.
Here's the logic:
True: If [PP] = "WG" or "WS" or "WL" and If [GR] > 10 Then "Skilled" or
[GR] Between 6-9 Then "Semi - Skilled" or [GR] <6 Then "Unskilled"
False: "GS"
View 2 Replies
View Related
Apr 4, 2013
I have a problem when I want to create an "ORDER" form, that will allow user to enter more than one order.
I have no clue how to do it.
View 14 Replies
View Related
Dec 27, 2014
I have a program that runs under access 2007 that I use at my work. We will soon be updating to MS office 2010 and the program will not work now because a calender file .ocx was removed from access 2010. Is there a way to get the 2007 .ocx file to work in access 2010?The program I am using is a relatively simple stand-alone and unsupported app that we use to request patient arrival and departure from various radiology tests inside a hospital. No reports are made from the app other than the number of patient transports for the day.
The app is placed on a common drive accessed from any pc in the hospital. No special permissions are required. But our app does use the calendar, time and date functions in access 2007. When I tried the app on a pc with access 2010, it basically says it (access) cannot open the app because a .ocx file is not present.Is there a way to make the access 2010 calendar file work in access 2007?
View 1 Replies
View Related
Jan 15, 2015
I have an Access 2010 database with two tables and two forms. The tables are Organizations and People. Similarly, the forms are Organizations Entry Form and PeopleEntryForm. The People are linked to the Organizations table. Several people can be linked to the same organization.On my Organizations EntryForm, I created a command button to duplicate a record using the wizard. It works fine.
I did exactly the same thing on the PeopleEntryForm, but instead of copying the record, it creates a new blank record. I don't get any error messages. Is my problem due to the fact that the People table is linked to the Organizations table?
View 13 Replies
View Related
Feb 10, 2008
Good morning,
I have a table ID (primary key) and
ID
--
FEASSDDE
RDSAAASE
NEESSDSD
AEIERIEIEE
and I want to do a select of these values, order by ID ASC, and see the position of each one in this order, something like this:
POS ID
--------------------
1 AEIERIEIEE
2 FEASSDDE
3 NEESSDSD
4 RDSAAASE
View 2 Replies
View Related
Feb 17, 2005
I have a startup form with three buttons. All three buttons have Tab Stop set to No. However, when I open the form, there is a highlighted box around what would have been the first button set in the tab order had Tab Stop been set to Yes. Is there a way to not display the light green box around the text in the button?
Thanks,
SKK
View 2 Replies
View Related
Nov 7, 2006
My tab order is the way I want it and when the user enters after the last field on the form, they get a new record. Problem is, the cursor is putting them in the last field on the form instead of the first one. I don't get it. The first field is first on the tab order list. Help.
View 1 Replies
View Related
Jun 16, 2005
I have a form (Members of the club), linked to a sub form (payments of membership).
When I open the record of Mr John, I want to see all his payments order by date of payment.
How do I do?
Thanks in advance,
Jackske - Belgium
:confused:
View 6 Replies
View Related
Sep 14, 2005
I have a query which i've ordered by date with:
ORDER BY status_reports.date;
But I want it to display in reverse order with most recent date first for example i want it in order of 18/sept/05 then 15/sept/05 then 10/sept/05.
im guessing i just need to add to the above SQL but im not sure what!
Can anyone help please
Thanks
View 3 Replies
View Related
Oct 10, 2005
How do you change a file's sort order from ascii to international?
View 3 Replies
View Related
Dec 9, 2005
Hi, is there any way to do an order by, but specify that a particular value is listed last, or first.
E.g. ORDER BY t_name ASC ... but feature Simon first and not with the other names beginning with 'S'
Thanks.
View 2 Replies
View Related
Dec 15, 2006
Hi,
I have a question.
why do we need to order MS Access application when the user request it in the company?
Suppose one user buy MS Access application, then we can install the other workstation, right. But, everytime, we need to order MS Access for that user account/workstation.
In contrast, ms word, ms excel, powerpoint, we don't need to order it, every workstation must have them, except ms access.
Can anybody response me why we need to order ms access for each user account/workstation?
Thanks.
View 10 Replies
View Related
Jan 30, 2007
Please help,
I have sorted my table by the primary key as when i open the form that loads fields from the table, i would like the most recent record entered to appear instead of the first record that was entered. The problem i have is when i run the form it still shows the first record even though i have sorted the primary key field in descending order. How do i fix this?
View 2 Replies
View Related
Jun 13, 2005
I'm using Access 2003 and a week ago I ran into a very strange problem with one of my tables. The table has 15 fields named Field1, Field2, Field3,....Field15. The weird thing that is happening is if I open the table in design view it will list the fields in order (Field1, Field2, Field3....Field15), but when I open the table in datasheet view Field10 and Field11 get flipped (.....Field8, Field9, Field11, Field10, Field12....). Has anyone every seen this before? I'm guessing it somehow got corrupted. It wouldn't be a real big deal for me to just delete the table and create a new one, but if there is a fix to it then I was wondering if someone could share that with me. Thanks.
View 2 Replies
View Related
Nov 7, 2005
Hi Folks,
I'm working on an order management database for a small company and have an order details form which I hoped to list each product of the order. As each customer has a different price per product I have a combo (based on a query) to choose the product and display the unit price (working fine) - the quantity and product ID are also input on the form and stored in the order details table (un-tested). My problem is on the first line of the order you choose the product and it and relevant details are shown, however, on line two, three etc when you choose the product - the other lines change to this too. How do I fix this???
Many Thanks in advance for help given!!
Mary
View 6 Replies
View Related
May 31, 2005
Hello,
I have a database which in one part records customer orders. What I would like to is identify customers who have not ordered for a given time period i.e. 30 days.
I know once I have built the query, I will require a parameter for the time period i.e.30 days.
I started by trying to record the last date ordered for a customer in a query, but am having problems with this. I had a query including information from my table for Orders (tblOrders). This had:
Order ID
Customer Name
Date Order Required
I do not need any more info apart from these fields.
The results would include all orders, so for some customers there would be numerous 'Order ID' & 'Date Order Required'. In the query, I did try to select the summary option, to group information by Customer - but the 'Date Order Required' was always the first date ordered. What I would like is only the last ones for all customers to be shown.
Can someone provide some guidance on how I can achieve my objective.
Thank you.
View 1 Replies
View Related
Jun 8, 2005
I have got a number of queries that query an MSSQL database that were running fine, but then I decided to tidy them up by giving them more meaningful column headings eg Pupil ref instead of tblPupil. Some of the queries are still fine but in some of them I can't get the columns to display in the order I want. In one, I have got columns called Round, Pupil ref and School but I can't stop the Pupil ref column coming first. If I delete it and put it in again, I can get it to go where I want (ie second) but as soon as I name it, it comes first and stays there even if I remove the name.
Please can anyone help
Fiona
View 4 Replies
View Related
Jun 22, 2006
I have to run a seniority query but have an issue. I have job descriptions but can't put them in ASC order because they wouldn't be by seniority.
For example:
Docker
Docker supervisor
Dock Chief
Shift Supervisor
Section Leader
In SQL I would do a decode function and assign each a number and then put them in order by thier number assigned.
What are my options in Query to perform this function. Thanks.
View 2 Replies
View Related
Mar 5, 2007
I want to sort my query results by VendorNumber (which is an AutoNumber won't be sequential due to deletions). I want to sort the query by what vendor number the current form is on. So if my vendor numbers are 1, 2, 14, 16, 17 and the vendor number on the form is 14, I want the query to be sorted with the Items from vendor 14 first then 16, 17, 1, 2.
Your time is appreciated,
JOe K.
View 7 Replies
View Related