Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

VBA Numbering for Cut Stack with Datamerge

Return to Member Forum

  • Author
    Posts
    • #58008
      MickRose
      Member

      For anyone using MS Access here is a very small (& probably poorly written) bit of code which generates a list of numbers for Datamerge. It can be used for such things as raffle tickets or anything else needing a cut stack sequence. Its not fully tested but it seems okay.

      You will need a form with input fields called Quantity, N up, Start, Batch, Digits, CorrectBatches, Pagination

      Maybe this could be be written as a Javascript by someone who knows what they are doing.

      Private Sub Command24_Click()

      Dim Text As String
      Dim Number As Integer
      [Sheets] = -Int(-[Quantity] / [N up])
      If [CorrectBatches] = “-1” And [Sheets] Mod [Batch] > 0 Then
      [Sheets] = Int([Sheets] / [Batch] + 1) * [Batch]
      [Quantity] = [Sheets] * [N up]
      MsgBox (“Extra sheets used to make Output a multiple of Batch sizes”)
      End If
      If [Sheets] Mod [Batch] <> 0 Then
      MsgBox (“Outputs not a multiple of Batch size – Tick the box & click again”)
      End If
      [QN] = [Sheets] * [N up]
      DoCmd.RunCommand acCmdRefresh
      Text = “Number” & vbNewLine
      For N = 1 To [Sheets]
      For NN = 0 To ([N up] – 1)
      Number = [Start] – 1 + N + [Sheets] * [NN]
      Text = Text & Right(“000000” & LTrim(Str(Number)), ([Digits])) & vbNewLine
      Next NN
      Number = NN
      Next N
      [Pagination] = Text
      DoCmd.GoToControl “Pagination”
      End Sub

Viewing 0 reply threads
  • You must be logged in to reply to this topic.
Forum Ads