Adding Autonumber columns into a Query Result

I searched the group message and i found a function below to create a
AutoNumber column for a Query result.

Creating an AutoNumber field from code

I dont know how i can run this code in my Query.

Name of the Query : Q1
Field Name: Quantities

I would like to have additional column named ID which will be produced
by this code.

Can you help me?

3/27/2007 11:33:36 AM
access.formscoding 7495 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 30


mezzanine1974 wrote:
> I searched the group message and i found a function below to create a
> AutoNumber column for a Query result.
> Creating an AutoNumber field from code
You can't use it, cause it is used to create a field in a table.

> I dont know how i can run this code in my Query.
You need a key to order, then you can use this:

   SELECT Count(*)
   FROM QuerySource I
   WHERE I.Key < O.Key
   ) AS ID
FROM QuerySource O

You may use the DCount() function instead of the subselect:

ID: DCount("*";"QuerySource";"Key<" & Key)

--> stefan <--
3/27/2007 11:54:13 AM

Similar Artilces:

Adding new server to New Admin Group?
Had a question - I have an existing exchange Administrative Group, and now I'm adding a new server at a remote location. Whenever I install exchange, it goes into my existing Admin group, instead of the new one I created. Read some posts and people are saying that when I run the install, exchange will let me choose which admin group it will go into, but that's not happening. Any idea why? Running Exchange 2003 SP1 on the other servers, everything is in the same domain name, just trying to separate this one out since it's a remote site that will have it's own smtp serv...

Adding Text Values
I'm looking for some assistance in writing a simple formula and I nee some help. I have a spreadsheet where I'm tracking types of visits. In m spreadsheet a: MV is a Missed Visit = a value of 1 VC is a Visit Completed = a value of 1 DC is a Discharge Visit = a value of 1 We are going to enter these values into a row (A) and I want tota these values based on this table. I know the solution is simple but don't know how to write it. Please help. Rud ----------------------------------------------- ~~ Message posted from ~~View and post usenet messages ...

Search a user and ad it to a group in all AD domain from file
Hi all, i'm tring to search a user in AD and add it to a group from a file(txt or excel it's not important). My problem is find the user in all OU AD. It's possible the user is in evry OU (ex.): ou=test,dc=domain,dc=com or in ou=marketing,ou=division,dc=domain,dc=com I write a script for a specific OU(i know the user path and group Path): strOU = "OU=import," strOUg = "OU=Sedi," strUser = "CN=Bill Gates" strGroup = "CN=grup test" ' Bind to Active Directory and get LDAP name Set objRootLDAP = GetObject("LDAP://Root...

How to get query/report to show an entry if system date
It is a little more complicated than that for me atleast. Here is the situation: I am making a "Daily Report" for our manning. We have people go on vaction and have appointments often in our office. I have built a database that we can enter in all of this information where (vacations, appointments, people coming and people going, etc...) My situation is I want to make a Daily Report to send out to each section everyday, but I do not want everything to show up for each form on the report. I only want what is going to affect that day. For Example: If Jason Jones is ...

Adding Autonumber with a prefix
Hi. Hope someone can help me? I have a database with the following fields. PalletID Location Trailer No Trailer Sheet No. (Currently Blank) Update We have a number of lorries, all with different Trailer Nos which come and go each day. When they are being loaded, the pallets get scanned and then placed on the trailer. What I am trying to do is run a query that says all lines with the update field of "0" and a location of "PL" I want to enter an autonumber eg. PL000001. Then when the next trailer has been scanned, I want to run the query again which will give all th...

Deleting Values From a Query's Results
I'm having problems trying to edit the values in a query results. I know there are restrictions on that kind of stuff. The values are pulled right out of a table. It's weather data that I pull out of an oracle table at work using ODBC. I pull down the data for a specific station and put it into a local table using a make table query. I then can crunch and display the results all different ways. The data is raw data and there are errors in it. I have queries set up using Dlookup where I can display, for example, apparently erroneous temps looking at the time & temp just befor...

Adding durations
Hi I'm using excel '97. I have a spread sheet with durations on it (vodafone) and want to add them. Is there any way to do this? When I highlight and hit sigma it tries to enter nothing in the top selection instead of the total at the bottom. Cheers BB Don't highlight. Just select a cell under your data and hit the sigma. You may have to paint the time format into it, or even format it Custom with [h]:mm:ss, to prevent the cell from tipping over at 24h -- Kind regards, Niek Otten Microsoft MVP - Excel -- Kind regards, Niek Otten Microsoft MVP - Excel "B Bear&quo...

How to pick up 1 number with a lot of same numbers in row/ column?
With a lot of same numbers in row/column, I want to pick up the number one time in new row/column. Any suggestion? Thank. One quick way - create a pivot table Assume your source data is running in A1 down Insert a new top row, enter a col header, eg: xxx Select col A, click Data > Pivot table Click Next > Next In step 3, click Layout Drag n drop xxx into ROW area Drag n drop xxx into DATA area If it appears as "Sum of xxx", just double click on it, then change it to Count under Summarize by Click OK > Finish Hop over to the pivot in the new sheet (to the left) where y...

changing thickness of Excel row and column headers
By this I mean the gray A through IV and 1 through 65535 on the edge of all worksheets. I haven't discovered a way to reproduce this on demand but it very definitely happens: some workbooks show thicker headings (BOTH) than others. If you haven't experienced this yourself there's no need to read further. You might see it if you open a half dozen workbooks created over a long span of time. seems to describe the problem exactly, if that helps... I recognize that the row number heading expands as you cross row 100...

Can I use the Windows AD Migration Tool AFTER I've used the AD Connector?
I am migrating from NT/Exchange 5.5 to Windows 2003/Exchange 2003. I have already installed the AD Connector as well as Exchange 2003 into the old Exchange 5.5 domain. All of the NT accounts that were not in the Windows 2003 AD have been replicated into a new container. I am now ready to move the mailboxes over to the new Exchange 2003 server. My question is..Can I use the Windows AD Migration tool to move over the SIDs to the new AD accounts? If I had used the AD migration tool BEFORE I had replicated accounts using the AC connector, it would have replicated the necessary information ...

Adding SMTP addresses to multiple users
Is there a way to add a new smtp address to a group of existing users (2000+) in an Exchange Organization / Active Directory Domain? Thanks. Why not create a Recipient Policy? Alternatively, check out -- Bharat Suneja MVP - Exchange NEW blog location: ---------------------------------------------- "bj" <> wrote in message > Is there a...

LDAP Query #4
im sorry if this post is in the wrong group how can i create an ldap query to get all the users with exchange boxes inside a specific OU this OU might also have OUs indise it with users that hafve mailboxes i want this to be able to create customized address lists Thank you Address Lists cannot be targeted at particular OUs. You need to use some user attribute that's common for users in that OU - like department, location, company name, etc. -- Bharat Suneja MCSE, MCT blog: ----------------------------------------- "Nazgyl" <naz...

adding lines to added data
I have added data to an existing worksheet but when printed the row lines and column border lines do not show. How do I add the lines to the added border to match the existing lines? ...

how can I import a csv file to Excel that has over 256 columns?
Hi I have several large csv files (semi colon separated) with over 256 columns of data that I need to convert to xls files. I can manually import 256 columns into a worksheet, then block those columns and import the next 256 into a new worksheet, but as some of the csv files have 750+ columns, is there a programmatical solution though that is easier (and quicker)? I deal with these files weekly so any help gratefully accepted! xl2007 has 16384 columns. And it should be released real soon now. wrote: > > Hi > > I have several large csv fi...

Make Table Query hits 2GB Limit
Hi, The funny thing is that the result set is would be only 340 thousand records. And there is lots of room in the current database. Its under 1/2 gig. So I tried to make the table in another database to secure all 2 GB worth of space for this table and it still compains about the 2GB limit. The machine has 4GB of RAM and 70GB of free space so its not anything on the machine that I can see. The Make Table is running a Crosstab query on a 1.5 Million record table and taking the summarized results into a table. I can run the Crosstab Query - no problem. Thats how I can see the number of...

Adding Property pages from Dll?
Hi, I want to create an app that allows the user to add property pages to my dialog box. I will off course have a basic property sheet but how can I add a page via a dll? Would COM be what I need? I recall something like that on codeproject but I cannot find it. Any hint? Many thanks Simon. I had this same requirement. I have a control panel applet that has a set of property pages. The applet will also look for components with certain extensions, LoadLibrary the module, and make a call into that dll via GetProcAddress mechanisms. One of the things returned is a pointer to a CProp...

Exchange Properties in AD.
All, I have a small problem, well at least one that might be able to be sorted out in this forum anyway. :) I am nearing the end of a domain consolidation project. We have been migration users from three different AD domains to one new one. Now two of these three were nice and simple due to their size and OU structure. The third is a pain in the you know where. What I need to know is what is the name of the object that I reference to find out if a user account has forward in place for email, what is the name of that forward and what OU is the user account in. I have the f...

graphic in excel based upon result
In one of the available templates, there are icons that appear in the results cell based upon if the result is at or below budget, and also variable icons based upon how far over budget. So, you see, for example, a green circle in the left section of the cell along with the results if you are at or below budget. I have a use for this functionality but need assistance as to how to program this. Hi Mike, Use Conditional Formatting in Excel 2007. Select the cell(s) of interest -->"Conditional Formatting" --> "Icon Sets" --> Select the icon set yo...

adding sql server compact in platform builder wince5.0
i would use sql server compact in .net (c#) what i have to add from catalog ? - SQL Compact - SQL Mobile - SQL Server CE 2.0 i tried on a device to create a db via SqlCeEngine.CreateDatabase on sotrage card but i get error: "SQL Mobile encountered problems when creating the database" HResult : -2147024882 NativeError : 28558 there is enough space on storage card .... You add what you want to use. SQL Compact is the most-recent of those. I don't usually build the database into the OS, myself. I feel like I'd rather install it to a completed device. ...

Pivottable:adding grand totals
How do you add together grand totals, also would there be a way to subtract a "grand total" from another number on another worksheet? You can use the GetPivotData function to return data from a pivot table. There's information here: and in Excel's Help. wrote: > How do you add together grand totals, also would there be a way to > subtract a "grand total" from another number on another worksheet? > -- Debra Dalgleish Excel FAQ, Tips & Book List

Adding hours
Hi, How can I do to add the hours 13:10 + 14:00 to obtain 27:10 instead of 03:10 ? Thanks in advance. Marcel Hi Marcel, Format the result cell as Custom, [hh]:mm -- Kind regards, Niek Otten Microsoft MVP - Excel "Marcel Nihon" <> wrote in message news:464f679e$0$7366$ | Hi, | How can I do to add the hours 13:10 + 14:00 | to obtain 27:10 | instead of 03:10 ? | Thanks in advance. | | Marcel | | How can I do to add the hours 13:10 + 14:00 | to obtain 27:10 | instead of 03:10 ? Niek Otten wrote: > Hi Marcel, &g...

quiry adding another field calculated from the existing fields
if I have a table of transactions on a bank account with two fileds: Field_1 holds the date of the transaction Field_2 holds the amount of the transaction What would be the quiry which would add the third filed Field_3 containing the balance on the account which is calculated as the value from the previous line of Field_3 less Filed_2 from the current line? You've no need to store the balances in a column in the base table, nor should you do so as it introduces redundancy and the risk of inconsistent data. The balances can be computed on the fly in query like so: SELECT Field_1, ...

Changing payee details
I'm using Money 2003 and when I download statement information from my bank, I often change the payee details to something more helpful. Having done this, Money 'remembers' the change so that when subsequent items are downloaded, the payee details are automatically changed again. This is a great feature that saves loads of time. Or at least it would be if it worked more reliably. Money seems to have a will of it's own in this area and some transactions have to be changed every time, despite being 100% consistent in my approach and with no change to the downloaded details. O...

Is there a way to create a chart that has 3 data bars on the primary axis and 1 line on a secondary axis? (Similar to the custom chart LINE-COLUMN ON 2 AXES but with 3 column bars.) Create a column chart from your data. Then, right-click on the series that you want as a line, and choose Chart Type from the menu. Select the Line category, and one of the Line subtypes, click OK. Jon Peltier has instructions for creating your own combination charts: Barb wrote: > Is there a way to create a chart that has 3 data bars o...

Sorting Column
:confused: Exporting tags from Autocad I end up with my first colum containin data such as A6r ....A35r & A6 ......A55, how can I sort this column i accending order by the number only, ignoring the letters....?????? All help appreciated Ing -- Ing ----------------------------------------------------------------------- Ingo's Profile: View this thread: separate the letters from the numbers "Ingo" wrote: > > :confused: > > Exportin...