Kiang- You must execute one DoCmd.OpenForm for each form you want to open. Do close a form, use:
DoCmd.Close acForm, "<name of form here>" John Viescas, author "Building Microsoft Access Applications" "Microsoft Office Access 2003 Inside Out" "Running Microsoft Access 2000" "SQL Queries for Mere Mortals" http://www.viescas.com/ > -----Original Message----- > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf Of yong_yong6666 > Sent: Wednesday, August 03, 2005 12:34 PM > To: [email protected] > Subject: [ms_access] Code to close & open various form simultaneously > > > Typyically, the code generated by MS Access will appear as below on > command button to open form on click : > ============================================== > Private Sub Command14_Click() > On Error GoTo Err_Command1444_Click > > Dim stDocName As String > Dim stLinkCriteria As String > > stDocName = "SCHEDULE" > > stLinkCriteria = "[ScheduleID]=" & Me![scheduleID] > DoCmd.OpenForm stDocName, , , stLinkCriteria > > Exit_Command14_Click: > Exit Sub > > Err_Command14_Click: > MsgBox Err.Description > Resume Exit_Command14_Click > > End Sub > ================================================= > My question : > > Can "stDocName" contain several forms ? For example, > stDocName = "SCHEDULE" > stDocName = "EXPENDITURE" > stDocName = "SHRINKAGE" > stDocName = "BUDGET" > Ultimately, on click, will all the 4 forms open up simultaneously ? > > What if, on click, I need > "SCHEDULE" & "EXPENDITURE" to be opened; and > "SHRINKAGE" & "BUDGET"to be closed ? > How could I insert Docmd.close for the the files to be closed ? > > Many thanks for the help rendered. > > Regards > Kiang > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor > --------------------~--> > <font face=arial size=-1><a > href="http://us.ard.yahoo.com/SIG=12hpmhdpm/M=362131.6882499.7 > 825260.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1123097702 > /A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org > ">Get Bzzzy! (real tools to help you find a job) Welcome to > the Sweet Life - brought to you by One Economy</a>.</font> > -------------------------------------------------------------- > ------~-> > > > Yahoo! Groups Links > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hnegta5/M=362131.6882499.7825260.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1123101275/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org ">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy</a>.</font> --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
