Results 1 to 6 of 6
  1. #1
    Carloj is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    24

    Split int in query

    Hi there,



    I want to split a order in seprate boxes. In order 12345 is defined box 50 until 100 . Now i want this in a query like:
    Order BOX
    12345 51
    12345 52
    12345 53
    12345 54
    (until 100)

    Is this possible in a query? or is it possible in a new box table?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    start at 51?
    end at 100? even with more records after 100?

    you can do it easy in a report,
    or
    append the data to a 'table' then use vb code to number them
    but
    doing it in a query is not easy or stable.

    (unless someone else has a query method?)

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    June recently posted some code on another forum which can be adapted

    Code:
    SELECT PONumber, Counter AS Box
    FROM tblPOs, (SELECT DISTINCT 100*Abs([Hundreds].[id] Mod 10)+10*Abs([Tens].[id] Mod 10)+Abs([Ones].[id] Mod 10)+1 AS Counter
    FROM MSysObjects AS Ones, MSysObjects AS Tens, MSysObjects AS Hundreds
    WHERE Ones.Id<0 AND Tens.Id<0 AND Hundreds.Id<0)  AS Counts
    WHERE Counter Between 51 And 100 AND PONumber=12345
    the code in red provides a number range from 1 to 999

  4. #4
    Carloj is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    24
    Quote Originally Posted by Ajax View Post
    June recently posted some code on another forum which can be adapted

    Code:
    SELECT PONumber, Counter AS Box
    FROM tblPOs, (SELECT DISTINCT 100*Abs([Hundreds].[id] Mod 10)+10*Abs([Tens].[id] Mod 10)+Abs([Ones].[id] Mod 10)+1 AS Counter
    FROM MSysObjects AS Ones, MSysObjects AS Tens, MSysObjects AS Hundreds
    WHERE Ones.Id<0 AND Tens.Id<0 AND Hundreds.Id<0)  AS Counts
    WHERE Counter Between 51 And 100 AND PONumber=12345
    the code in red provides a number range from 1 to 999
    Do you got a link to the thread?

  5. #5
    Carloj is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    24
    Quote Originally Posted by ranman256 View Post
    start at 51?
    end at 100? even with more records after 100?

    you can do it easy in a report,
    or
    append the data to a 'table' then use vb code to number them
    but
    doing it in a query is not easy or stable.

    (unless someone else has a query method?)
    It can go up to a million.

    do you got an example of append the data and a vb code?

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    have to ask, why would you want to create 1m boxes for 1 order in one go? I suspect there is a better way to go. Creating 1m records in one go will take time, and if happens frequently may need consider a sql server backend due to space requirements for all those records

    re link - see post #3

    https://www.access-programmers.co.uk...d.php?t=302140

    if you need to go to a million, you will need to add further msysobjects for thousands, 10's thousands, etc

Please reply to this thread with any new information or opinions.

Similar Threads

  1. query results into split form?
    By murphy63 in forum Forms
    Replies: 10
    Last Post: 10-04-2016, 09:53 AM
  2. Split form on append query
    By OneToLearn in forum Queries
    Replies: 1
    Last Post: 04-16-2012, 11:20 PM
  3. Split Record Query
    By Flippa in forum Queries
    Replies: 1
    Last Post: 12-15-2011, 05:27 PM
  4. Crosstab Query / Split Database
    By ksmith in forum Programming
    Replies: 2
    Last Post: 11-18-2010, 11:55 AM
  5. Split data by using query
    By lamkee in forum Queries
    Replies: 1
    Last Post: 11-07-2010, 11:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums