+ Reply to Thread
Results 1 to 8 of 8

Auto Number Field in Query

  1. #1
    Forum Contributor
    Join Date
    10-30-2011
    Location
    Doha
    MS-Off Ver
    MS office 365
    Posts
    701

    Auto Number Field in Query

    Folks,

    I have database with a table "All_Jobs" and a Query "Justified", what I am looking for when I run the Query I want to show a Field "SL" and should get Auto Number (Records Count). I have attached a file of what I'm trying to accomplish. Thanks in advance for your expertise!

    Thanks in advance.

    Joshi
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Auto Number Field in Query

    Changed Expressionn to surround each variable with square brackets and it seems to work.
    Please Login or Register  to view this content.
    See attached.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    10-30-2011
    Location
    Doha
    MS-Off Ver
    MS office 365
    Posts
    701

    Re: Auto Number Field in Query

    Hi alansidman,

    Thanks for your reply, actually what I am looking for when I run the query the SL field should be showed Auto number, like 1, 2, 3 uniquely not the count of records. Can you please help me to resolve this issue?

    Thanks in advance.

    Joshi

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Auto Number Field in Query

    There may be some other ways, but the simplest way that I can think of is to either create a report from your query and put in row numbers as shown in this video
    http://www.datapigtechnologies.com/f...minreport.html
    or use the select query that you have and do a maketable query. In your new table you can then add an autonumber field with the table open in design mode.

  5. #5
    Forum Contributor
    Join Date
    10-30-2011
    Location
    Doha
    MS-Off Ver
    MS office 365
    Posts
    701

    Re: Auto Number Field in Query

    HI alansidman,

    Thanks for your advice, Can we make a Macro to create maketable of my "Justified" query??. Please help me?

    Thanks,
    Joshi

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Auto Number Field in Query

    You don't need a macro or VBA (my preferred method of automation). With your query open in design mode, and the ribbon tab open to design, select the make table icon.

    Here is some VBA for you to consider if you want to do this with a command button.

    http://bytes.com/topic/access/answer...-query-via-vba

  7. #7
    Forum Contributor
    Join Date
    10-30-2011
    Location
    Doha
    MS-Off Ver
    MS office 365
    Posts
    701

    Re: Auto Number Field in Query

    HI alansidman,

    Thanks for your advice. Finally I got a module to get Serial Number Field for my first query "Justified" , But I could not use the same method for my second query "NotJustified". I have attached the database. Could you please check and advise??

    Thanks,
    Joshi
    Attached Files Attached Files

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Auto Number Field in Query

    Cannot see an issue. Appears that your function Serialize is doing as required. Both queries return a 1 up number for the SL field.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1