[AccessD] Subform question

Mike and Doris Manning mikedorism at ntelos.net
Fri Aug 15 15:58:37 CDT 2003


Try this...

    Dim ItemName As String
    
    'Set the focus to cmdClose and get the subform's
    'current source object
    cmdClose.SetFocus
    ItemName = frmInfo.SourceObject
       
    'Change the form's view
    frmInfo.Visible = False
    frmInfo.SourceObject = ""
    
    DoCmd.Echo False
    DoCmd.OpenForm ItemName, acViewDesign
    Forms(ItemName).DefaultView = 2
    DoCmd.Close acForm, ItemName, acSaveYes
    DoCmd.Echo True
    
    'Redisplay the subform
    frmInfo.SourceObject = ItemName
    frmInfo.Visible = True

You would use similar code for FormView changing the default view to either
0 (Single Form) or 1 (Continuous Form).

Doris Manning
Database Administrator
Hargrove Inc.
www.hargroveinc.com


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Michael Brösdorf
Sent: Friday, August 15, 2003 3:59 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Subform question


Dear group,

is it possible to switch a subform from form view to datasheet view during
runtime of the main form? I tried changing me.sfrmList.form.currentview and
me.sfrmList.form.defaultview, but that seems to be working in design view
only.


TIA,

Michael

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list