Arranging exam register number data in zigzag order in ms access report

vsk1975

Registered User.
Local time
Today, 15:27
Joined
Mar 28, 2018
Messages
15
Sir
My access report contains exam register numbers in 4 columns and I would like to arrange it in zigzag order as given below

120321 120322 120323 120324
120328 120327 120326 120325
120329 120330 120331 120332

Please Help

Thanks
 
Don't know about zigzag,but in report page setup,
page setup, columns, either:

down, then across,
across, then down (aka zigzag?)
 
I don't think you can made it without involving some VBA code that set a sort order, then it is not exactly zigzag order, but Ascending for four values then Descending for four values then again Ascending for four values etc.
 
sir, a single page contains eighty register numbers , it should be arranged like this

first row from left to right
second row from right to left
third row from left to right etc

each row contains 4 register numbers
 
..
first row from left to right
second row from right to left
third row from left to right etc

each row contains 4 register numbers
Exactly what I wrote, still I don't think you can made it without involving some VBA code that set a sort order.
Post your database, zip it!
 
sir here is the zipped file . It is a simple db file please give a solution
thanks
 

Attachments

The term you are looking for if I recall correctly is "snaking". I recall doing this with labels.

Here is one link, but I'm sure you can google others and/or a tutorial.
Another link
 
Last edited:
Exactly what I wrote, still I don't think you can made it without involving some VBA code that set a sort order.
Post your database, zip it!
I think that is how I would do it. Add a sort column to the table. Determine you number of columns and number the columns. Then show in a columnar report.
 
Here's what I get with your data using 4 columns with snaking (across then down). Hope that's what you want.

attachment.php
 

Attachments

  • snakedReport4Columns.PNG
    snakedReport4Columns.PNG
    49.6 KB · Views: 438
Add a field sort order to your table and run the code I get the below if I sort by sortorder.

Code:
120321 120322 120323 120324
120328 120327 120326 120325
120329 120330 120331 120332

Code:
Public Sub AddSort(NumberColumns As Integer)
  Dim rs As DAO.Recordset
  Dim strSql As String
  Dim i As Integer
  Dim rowCountDiv As Double
  Dim rowcount As Integer
  Dim direction As Integer
  Dim sortOrder As Integer
  Dim itmInRow As Integer
  Set rs = CurrentDb.OpenRecordset("Select * from table1 order by regno")
  direction = 1  ' 1 forward 0 backward
  Do While Not rs.EOF
    rowCountDiv = (rs.AbsolutePosition) / NumberColumns
    If rowCountDiv = Int(rowCountDiv) Then
      rowcount = rowcount + 1
      itmInRow = 0
      direction = rowcount Mod 2
    End If
    If direction = 1 Then
      sortOrder = rs.AbsolutePosition + 1
    Else
      sortOrder = (rowcount * NumberColumns) - itmInRow
    End If
    Debug.Print rs.AbsolutePosition + 1 & " " & rowcount & " Mod " & rowcount Mod 2 & " " & sortOrder
     itmInRow = itmInRow + 1
     rs.Edit
       rs!sortOrder = sortOrder
     rs.Update
       
     rs.MoveNext
     
  Loop
  
End Sub

Public Sub TestCount()
  AddSort 4
End Sub
 
Example sort order
Code:
regno	sortOrder
120321	1
120322	2
120323	3
120324	4
120325	8
120326	7
120327	6
120328	5
120329	9
120330	10
120331	11
120332	12
120333	16
120334	15
120335	14
120336	13
120337	17
120338	18
120339	19
120340	20
120341	24
120342	23
120343	22
120344	21
120345	25
120346	26
120347	27
120348	28
120349	32
120350	31
120351	30
120352	29

attachment.php
 

Attachments

  • zigzag.jpg
    zigzag.jpg
    70.5 KB · Views: 409
Last edited:
Many Many Thanks Sir
The Given Code Works Perfectly
 

Users who are viewing this thread

Back
Top Bottom