[AccessD] how to change form default view via VBA

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Tue Apr 17 17:18:03 CDT 2007


I just had to do this.  OK, it's not exactly what you're looking for but
it's a work-around, yes?  You make the form a sub form and change the source
object.  I have two subforms - one's a continuous form, one's a datasheet
form. 

This is the code behind a command button on the main form to toggle the
sub-form.  

    If Me.subfrmPODetail.SourceObject = "subfrmPODetail" Then
        Me.subfrmPODetail.SourceObject = "subfrmPODetailDatasheet"
    Else
        Me.subfrmPODetail.SourceObject = "subfrmPODetail"
    End If
    Me.subfrmPODetail.Requery

HTH

Rocky
 




 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Billy Pang
Sent: Tuesday, April 17, 2007 2:10 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] how to change form default view via VBA

Hello:

Is it possible to change the default view of a form in MS Access using VBA?
I would like to have the user toggle between the datasheet view and the form
view using a button

thanks in advance

Billy

--
Billy Pang
http://dbnotes.blogspot.com/
"Once the game is over, the King and the pawn go back in the same box." -
Italian proverb
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 269.5.0/763 - Release Date: 4/16/2007
5:53 PM
 




More information about the AccessD mailing list