How to make Continuous form (like in access) with visual basic form.

Posted on 2004-09-30
Medium Priority
Last Modified: 2013-11-25
Dear All,

I'm a VB newbie, is there any information or examples for making continuous form (like in access) with visual basic form...

Please Advise,
Question by:fbachri
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
LVL 10

Expert Comment

ID: 12197110
hi !!

for creating a continous form in VB.. u need to create a control array for each control that u require to be repeated for every record...
say if we have 2 textboxes and two labels then
dim i!

set textboxes and labels index property to 0

while not rs.eof 'where rs is the recordset
if i <> 0 then
  Load text1(i)
  Load text2(i)
  Load Label1(i)
  Load Label2(i)

  text1(i).top = text1(i-1).top + 500
  text2(i).top  = text2(i-1).top + 500
  Label1(i).top = Label1(i-1).top + 500
  Label2(i).top = = Label2(i-1).top + 500


end if

  text1(i) = rs!Name
  text2(i) = rs!Age

Author Comment

ID: 12197717
Dear anv,

Thanks for your advise, it works!...but i still confuse how to combine the form with a horisontal/vertical scrollbar so the form is scrollable.

please advise,

LVL 10

Expert Comment

ID: 12197753
Add an MDI Form to ur Application..

and set ur continous forms MDI Child property to true..

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  


Author Comment

ID: 12197816
Dear anv,

I have add an MDI form to my apps. and set my continuos form MDI Child property to true. but unfortunately i have an error message:

Compile Error:

Function or interface marked as restricted, or the function uses an Automation type not Supported in Visual Basic.

Below is the code in my continuous form :
Private Sub Form_Load()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i

Me.MDIChild = True                             '<------ set ur continous forms MDI Child property to true
With con
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                    "Persist Security Info=False;Data Source=" & _
                    App.Path & "\db3.mdb"
End With
rs.Open "SELECT * FROM Table1", con, adOpenDynamic, , adCmdText

i = 0
While Not rs.EOF 'where rs is the recordset
If i <> 0 Then
  Load Text1(i)
  Load Text2(i)
  Load Text3(i)

  Text1(i).Top = Text1(i - 1).Top + 500
  Text2(i).Top = Text2(i - 1).Top + 500
  Text3(i).Top = Text2(i - 1).Top + 500

  Text1(i).Visible = True
  Text2(i).Visible = True
  Text3(i).Visible = True
End If
  Text1(i) = rs!tes1
  Text2(i) = rs!tes2
  Text3(i) = rs!tes3
  i = i + 1
End Sub

Please advise....

LVL 10

Expert Comment

ID: 12197835
you cannot set

MDIChild property at run time this way..

set it True in design time..

Author Comment

ID: 12197872
The continuous form MDI child property has set to true in the design time now. and now what should i write in the scrollbar Vscroll_Change() event to make it work?

Sorry my basic question. i hope you don't mind...

LVL 10

Expert Comment

ID: 12198033
r u using Scroll bars in the continous form or what??

u dont have to include any scroll bar object in ur continous form..

as now MDI will automatically add scroll bars to the form if size of continous form increases...  also set the continous form's windowstate to normal..at design time..

also for MDI set scrollbars to true..


Author Comment

ID: 12198125
Yes i am using a scroll bar in the continuous form. but now i've delete it. but after following your instruction the mdi form still not display the scrollbar.

maybe you can check my apps. i will send the code to you but i need your email address. what i want is a continuous form just like in access. that it will display a scrollbar when the data show in the form are plenty enough.

LVL 10

Expert Comment

ID: 12198149
send me the code to


Author Comment

ID: 12198179
Dear anv,

i've send the code to you....

LVL 10

Accepted Solution

anv earned 400 total points
ID: 12198350
add this statement

at the end of form load event

Me.Height = Text1(i - 1).Top + Text1(i - 1).Height

and u'll get the scroll bar..

one more thing..

since there is a limit to the height of child form (which is = 9000)

so better would be if u add a fram control that will contain all the controls that ar ecurrently on the form..

and u'll have use scrolling logic like following..

Private Sub show_scroll()

Dim intScrollMax As Integer

    If Not Me.WindowState = vbMinimized Then
        intScrollMax = (pFrame.height - Me.ScaleHeight) + 345  '345 for status bar
        'Check if we need a scroll bar
        If intScrollMax > 0 Then
            VScroll1.Min = 0
            VScroll1.Max = intScrollMax
            'move the scrollbar
            VScroll1.Move pFrame.width, 0, 255, Me.ScaleHeight - 375
            Me.width = VScroll1.Left + VScroll1.width + 100
            picStatus.width = Me.width
            VScroll1.Visible = True
            scroll_shown = True
    '            Else
    '                If scroll_shown = True Then
    '                    Me.width = Me.ScaleWidth
    '                    'StatusBar1.width = Me.width
    '                    VScroll1.Visible = False
    '                    scroll_shown = False
    '                End If
    '            End If
            If scroll_shown = True Then
                Me.width = VScroll1.Left + 100
                picStatus.width = Me.width
                VScroll1.Value = 0
                VScroll1.Visible = False
                scroll_shown = False
            End If
        End If
        VScroll1.LargeChange = Me.ScaleHeight
        VScroll1.SmallChange = Me.ScaleHeight / 10
        'VScroll1.Value = 0
    End If
End Sub

Private Sub ScrollFrame()
Static intVal As Integer
Dim intChange As Integer

    intChange = intVal - VScroll1.Value
    pFrame.Top = pFrame.Top + intChange
   ' Debug.Print pFrame.top
    intVal = VScroll1.Value
    'scroll_value = VScroll1.value
End Sub

Private Sub VScroll1_Change()


End Sub

Private Sub VScroll1_Scroll()
End Sub

'above code was used in one of my projects.. so please change it as per ur requirement..


Author Comment

ID: 12198433
OK...thank you very much for your valuable information.


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question