From: Gopb via AccessMonster.com on 7 Dec 2009 10:45 I have been using access 2002 and now I'm using access 2007. Everything seems to work except Rogers "choose report from list 3" code. I click on the I choose the report click the open button and the report does not execute. Here is the code for thet button. Is the code ok or is the problem somewhere else in ? Private Sub cmdOpen_Click() On Error GoTo Err_cmdOpen_Click Dim stDocName As String Dim stLinkCriteria As String If IsNull(Me!lstForms) Then MsgBox "You must choose a report", vbExclamation Else stDocName = Me!lstForms.Column(0) If Me!lstForms.Column(1) = -32764 Then stDocName = "rpt" & stDocName DoCmd.OpenReport stDocName, acPreview 'makes the form invisible until the report is closed Me.Visible = False Do While SysCmd(acSysCmdGetObjectState, acReport, stDocName) DoEvents Loop Me.Visible = True Else stDocName = "rpf" & stDocName DoCmd.OpenForm stDocName, acNormal 'makes the form invisible until the report is closed Me.Visible = False Do While SysCmd(acSysCmdGetObjectState, acForm, stDocName) DoEvents Loop Me.Visible = True End If End If Exit_cmdOpen_Click: Exit Sub Err_cmdOpen_Click: MsgBox Err.Description Resume Exit_cmdOpen_Click End Sub Private Sub cmdClose_Click() On Error GoTo Err_cmdClose_Click DoCmd.Close Exit_cmdClose_Click: Exit Sub Err_cmdClose_Click: MsgBox Err.Description Resume Exit_cmdClose_Click End Sub Private Sub lstForms_DblClick(Cancel As Integer) cmdOpen_Click End Sub Private Sub Command7_Click() On Error GoTo Err_Command7_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Explanation - ChooseReportOrParameterForm" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Command7_Click: Exit Sub Err_Command7_Click: MsgBox Err.Description Resume Exit_Command7_Click End Sub Thanks Gaetan -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200912/1
|
Pages: 1 Prev: Form different size in form view vs design view Next: Saving a record in subform |