Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Preventing forms to load in MS Acess

eyesonlyeyesonly Member Posts: 10
I am new to ms access.. My question is regarding forms, I used to program in vb6.. is there a way to prevent a form from loading.. meaning it should be loaded within in a another form.. like parent-child relationship.. that the child form cannot be loaded independently.. I would appreciate help about this topic.. tnx..

Comments

  • abitw2abitw2 Member Posts: 4
    One way would check for the parent being loaded. If it isn't loaded, then close the form.


    In the OnLoad event of the child form:

    Private Sub Form_Load()
    If Not FrmLoaded("Parent Form") Then
    DoCmd.Close acForm, Me.Name
    End If
    End Sub

    Where FrmLoaded:

    Function FrmLoaded(ByVal frm_name As String) As Boolean
    Dim frm As Form
    If Application.Forms.Count = 0 Then Exit Function
    For Each frm In Application.Forms
    If frm.Name = frm_name Then FrmLoaded = True
    Next frm
    End Function


    Hope this helps,
    Andy
  • abitw2abitw2 Member Posts: 4
    One way would check for the parent being loaded. If it isn't loaded, then close the form.


    In the OnLoad event of the child form:

    Private Sub Form_Load()
    If Not FrmLoaded("Parent Form") Then
    DoCmd.Close acForm, Me.Name
    End If
    End Sub

    Where FrmLoaded:

    Function FrmLoaded(ByVal frm_name As String) As Boolean
    Dim frm As Form
    If Application.Forms.Count = 0 Then Exit Function
    For Each frm In Application.Forms
    If frm.Name = frm_name Then FrmLoaded = True
    Next frm
    End Function


    Hope this helps,
    Andy
  • eyesonlyeyesonly Member Posts: 10
    Thanks andy for the reply.. You must be an really expert in MS Access s.. so I'd like to take this opportunity to ask some question regarding Access.. how does it match with other DB (e.g. FoxPro) can it handle a large chunks of data? and what about using it as an front-end for MySQL, is it a good tandem?

    Thank you again..
Sign In or Register to comment.