Arranging exam register number data in zigzag order in ms access report (1 Viewer)

vsk1975

Registered User.
Local time
Today, 11:05
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
 

Ranman256

Well-known member
Local time
Today, 01:35
Joined
Apr 9, 2015
Messages
4,339
Don't know about zigzag,but in report page setup,
page setup, columns, either:

down, then across,
across, then down (aka zigzag?)
 

JHB

Have been here a while
Local time
Today, 06:35
Joined
Jun 17, 2012
Messages
7,732
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.
 

vsk1975

Registered User.
Local time
Today, 11:05
Joined
Mar 28, 2018
Messages
15
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
 

JHB

Have been here a while
Local time
Today, 06:35
Joined
Jun 17, 2012
Messages
7,732
..
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!
 

vsk1975

Registered User.
Local time
Today, 11:05
Joined
Mar 28, 2018
Messages
15
sir here is the zipped file . It is a simple db file please give a solution
thanks
 

Attachments

  • registernumbers.zip
    14.8 KB · Views: 109

jdraw

Super Moderator
Staff member
Local time
Today, 01:35
Joined
Jan 23, 2006
Messages
15,364
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:

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:35
Joined
May 21, 2018
Messages
8,463
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.
 

jdraw

Super Moderator
Staff member
Local time
Today, 01:35
Joined
Jan 23, 2006
Messages
15,364
Here's what I get with your data using 4 columns with snaking (across then down). Hope that's what you want.

 

Attachments

  • snakedReport4Columns.PNG
    snakedReport4Columns.PNG
    49.6 KB · Views: 315

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:35
Joined
May 21, 2018
Messages
8,463
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
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 01:35
Joined
May 21, 2018
Messages
8,463
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

 

Attachments

  • zigzag.jpg
    zigzag.jpg
    70.5 KB · Views: 308
Last edited:

vsk1975

Registered User.
Local time
Today, 11:05
Joined
Mar 28, 2018
Messages
15
Many Many Thanks Sir
The Given Code Works Perfectly
 

Users who are viewing this thread

Top Bottom