Micron,
Here are the two forms. One is subform on main menu, one is a subform on Account
The code listed below is to Open the report with the codes criteria!
Both forms are the same except for the Account form I have a check box to open an individual record.
Both codes are the same except for the form/subform
If I have no date in forms and is #2 in optiongroup, then I dont want the txt boxes to be visible opening from either form.
If I open form from Main Menu with dates and Option #1, then I want one of the two txt boxes to be visible and one not visible
If I open from Account with dates and Option #1, then I want one of the two txt boxes to be visible and one not visible
I beleive the criteria is all there except for what form it is in the report~ Hope this makes sense
These are the two txt boxes on report form
BetwenTransDateMM
="For Transactions Between: " & [Forms]![frmMainMenu].[sfrmMainMenu].[Form]![BeginningTransDate] & " and " & [Forms]![frmMainMenu].[sfrmMainMenu].[Form]![EndingTransDate]
BetwenTransDate
="For Transactions Between: " & [Forms]![frmAccount].[sfrmAccount].[Form]![BeginningTransDate] & " and " & [Forms]![frmAccount].[sfrmAccount].[Form]![EndingTransDate]
This is code from MainMenu, Error code removed
Code:
Private Sub CmdReport_Click()
Dim varItem As Variant
Dim strDoc As String
If IsNull(Me.LstCategoryReport.Column(0)) Then
MsgBox "You must select a Report from Reprot List!"
Exit Sub
End If
With Me.LstCategoryReport
For Each varItem In .ItemsSelected
strDoc = .Column(1, varItem) 'assumes list box has two columns, the first one holding the reportID is the bound one and hidden
Next
End With
If Not IsNull(Me.LstCategory.Column(0)) And IsNull(Me.LstCategorySub.Column(0)) Then
DoCmd.OpenReport strDoc, acViewPreview, , "[CategoryID] in(" & getLBX(Me.LstCategory) & ")"
ElseIf Not IsNull(Me.LstCategory.Column(0)) And Not IsNull(Me.LstCategorySub.Column(0)) Then
DoCmd.OpenReport strDoc, acViewPreview, , "[SubCategoryID] in(" & getLBX(Me.LstCategorySub) & ")"
Else
If Me.grpFilterOptions = 2 Then
DoCmd.OpenReport strDoc, acViewPreview
Else
DoCmd.OpenReport strDoc, acViewPreview, , Forms![frmMainMenu].[sfrmMainMenu].Form.txtReportFilter, acNormal
End If
End If
End Sub
This is the code from Account, Error code removed
Code:
Private Sub CmdReport_Click()
Dim varItem As Variant
Dim strDoc As String
If IsNull(Me.LstCategoryReport.Column(0)) Then
MsgBox "You must select a Report from Reprot List!"
Exit Sub
End If
With Me.LstCategoryReport
For Each varItem In .ItemsSelected
strDoc = .Column(1, varItem) 'assumes list box has two columns, the first one holding the reportID is the bound one and hidden
Next
End With
If Not IsNull(Me.LstCategory.Column(0)) And IsNull(Me.LstCategorySub.Column(0)) Then
DoCmd.OpenReport strDoc, acViewPreview, , "[CategoryID] in(" & getLBX(Me.LstCategory) & ")"
ElseIf Not IsNull(Me.LstCategory.Column(0)) And Not IsNull(Me.LstCategorySub.Column(0)) Then
DoCmd.OpenReport strDoc, acViewPreview, , "[SubCategoryID] in(" & getLBX(Me.LstCategorySub) & ")"
Else
If Me.grpFilterOptions = 2 Then
DoCmd.OpenReport strDoc, acViewPreview
Else
DoCmd.OpenReport strDoc, acViewPreview, , Forms![frmAccount].[sfrmAccount].Form.txtReportFilter, acNormal
End If
End If
If Forms!frmAccount.sfrmAccount.Form.chkSingle = True Then
DoCmd.OpenReport strDoc, acViewPreview, , "AccountID=" & Forms!frmAccount!AccountID
Else
DoCmd.OpenReport strDoc, acViewPreview
End If
End Sub