Results 1 to 2 of 2
  1. #1
    jjenas is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    1

    How to Duplicate values automatically

    I have create a form to input values. All values should duplicate based on one column.


    Form example i have 4 in boxes A,b,c,d.
    A= Is auto generated sequence number with prefix
    B=Test
    C=Test
    D=3.

    If d is 3 then, all values should be entered 3 times and A should be unique all times. For next entry a should automatically goto 4

    A b c
    ID 1 test test
    ID 2 test test
    ID 3 test test


    Thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    make an append query to loop N times.
    the query qsKeyVals shows the A col. as numeric values to get the last entry: MaxAVal: Val([A])

    Code:
    docmd.setwarnings false
    iStart = Dmax("[MaxAVal]","qsKeyVals")
    
    for i = 1 to D
      sKey = "ID " & iStart  + i
      sSql = Insert Into table (A, B, C) values ('" & sKey & "','" & txtBoxB & "','" & txtBoxC & "')"
      docmd.runSql sSql
    next

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

Similar Threads

  1. duplicate Values
    By CHEECO in forum Access
    Replies: 2
    Last Post: 02-21-2018, 03:37 PM
  2. SUm duplicate values then delete duplicate rows
    By DonKaponne in forum Queries
    Replies: 1
    Last Post: 09-14-2014, 04:18 PM
  3. Replies: 5
    Last Post: 01-29-2013, 03:38 PM
  4. duplicate values
    By tarhim47 in forum Access
    Replies: 7
    Last Post: 05-03-2011, 11:30 AM
  5. Replies: 2
    Last Post: 04-20-2011, 06:59 AM

Tags for this Thread

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