Sort notes as desired (1 Viewer)

Murad

New member
Local time
Today, 03:12
Joined
Jan 13, 2021
Messages
4
Hi There
I want when I choose a note
the notes are arranged under each other using the code without using layout in table
her is a test db

thanks
 

Attachments

  • testDbNotes.accdb
    1.1 MB · Views: 41

cheekybuddha

AWF VIP
Local time
Today, 01:12
Joined
Jul 21, 2014
Messages
2,280
If you do not use a table, then how will you persist the selected notes between closing and re-opening the form?

You haven't really described exactly what you are trying to achieve, but you can try the following code to see if it is what you are looking for:
Code:
Option Compare Database
Option Explicit

Private Sub chk1_AfterUpdate()
'If chk1 = True Then B1.Visible = True: B1.Height = 380: Box1.Visible = True: Box1.Height = 850 Else: B1.Visible = False: B1.Height = 0: Box1.Visible = False: Box1.Height = 0
  Call ArrangeBoxes
End Sub

Private Sub chk2_AfterUpdate()
'If chk2 = True Then B2.Visible = True: B2.Height = 380: Box2.Visible = True: Box2.Height = 850 Else: B2.Visible = False: B2.Height = 0: Box2.Visible = False: Box2.Height = 0
  Call ArrangeBoxes
End Sub

Private Sub chk3_AfterUpdate()
'If chk3 = True Then B3.Visible = True: B3.Height = 380: Box3.Visible = True: Box3.Height = 850 Else: B3.Visible = False: B3.Height = 0: Box3.Visible = False: Box3.Height = 0
  Call ArrangeBoxes
End Sub

Private Sub chk4_AfterUpdate()
'If chk4 = True Then B4.Visible = True: B4.Height = 380: Box4.Visible = True: Box4.Height = 850 Else: B4.Visible = False: B4.Height = 0: Box4.Visible = False: Box4.Height = 0
  Call ArrangeBoxes
End Sub

Private Sub Form_load()
'Call chk1_AfterUpdate
'Call chk2_AfterUpdate
'Call chk3_AfterUpdate
'Call chk4_AfterUpdate
  Call ArrangeBoxes
End Sub

Private Function ArrangeBoxes() As Boolean

  Const BTN_HEIGHT As Integer = 380
  Const BOX_HEIGHT As Integer = 850
  Const BTN_TOP As Integer = 1230
  Const BOX_TOP As Integer = 285
 
  Dim iCount As Integer, iVisible As Integer, i As Integer
 
  iVisible = 0
  For i = 1 To 4
    iVisible = iVisible - Me("chk" & i)
    With Me("B" & i)
      .Visible = Me("chk" & i)
      .Top = BTN_TOP + (iVisible * BTN_HEIGHT)
    End With
    With Me("Box" & i)
      .Visible = Me("Chk" & i)
      .Top = BOX_TOP + (iVisible * BOX_HEIGHT)
    End With
  Next i
  ArrangeBoxes = Err = 0
 
End Function
 

Murad

New member
Local time
Today, 03:12
Joined
Jan 13, 2021
Messages
4
that exactly what i need
thank you very much
(y)
 

Users who are viewing this thread

Top Bottom