Results 1 to 4 of 4
  1. #1
    baggieboy is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    5

    value of a field determine the number of records in a new table/query

    Hi



    I'm trying to use the value in field B to determine the number of times the value in Field A is repeated in a new table or query.

    So trying to get from a table that looks like this:
    Field A Field B
    1 4
    2 2
    3 6

    To one that looks like this:
    Field A
    1
    1
    1
    1
    2
    2
    3
    3
    3
    3
    3
    3

    Not sure if this is best done with a query, or with VBA?

    Many thanks in advance

    John

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,420
    think you'll need to use vba, don't see how you could do it with a query

  3. #3
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    baggieboy, having a hard time understanding why you would want to replicate the same data in a table multiple times unless there is more fields that make each entry unique? if field B of the second table has a unique value then that would explain it and make it simpler to do. I think more background is needed because depending on the circumstances will answer your question.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    Would need VBA to write records to a table - usually called a 'temp' table because the data is purged each time the process is run.

    Why do you need this? Is it a one-time event or will this be done periodically?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 05-28-2015, 10:01 AM
  2. Function to Determine Number of Workdays Error
    By McArthurGDM in forum Modules
    Replies: 3
    Last Post: 12-08-2014, 02:51 PM
  3. Replies: 9
    Last Post: 06-06-2012, 10:35 AM
  4. Sequentially number records in a table field
    By kenton.l.sparks@gmail.com in forum Programming
    Replies: 4
    Last Post: 04-08-2011, 08:24 PM
  5. Replies: 1
    Last Post: 01-31-2009, 10:43 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