S
Sharon
I have tried to use an option group and a combo box as shown in the approach
by Martin Green at www.fontstuff.com CascadingListDemo4. After days or work,
I cannot get it to work properly. I am not using a table for the
ReportNumbers, but am using a union query "qryAllReports" that list all of
the Report Numbers from 3 separate tables. I have gone around and around
until I am so confused I don't know where I have gone wrong. Can anyone help?
Private Sub grpReportName_AfterUpdate()
On Error Resume Next
Dim strReportType As String
Select Case grpReportName.Value
Case 1
strReportType = "ExpenseReport"
Case 2
strReportType = "TravelExpenseReport"
Case 3
strReportType = "Purchase Req."
Case 4
strReportType = "CheckRequest"
End Select
cboReportNumber.RowSource = "Select qryAllReports.ReportNumber " & _
"FROM qryAllReports " & _
"WHERE tblReportType.ReportName = '" & strReportType & "' " & _
"ORDER BY qryAllReports.ReportNumber;"
End Sub
Private Sub Form_Current()
On Error Resume Next
Dim strReportType As String
If IsNull(cboReportNumber.Value) Then
grpReportName.Value = Null
End If
' Synchronise ReportType combo with existing ReportNumber
strReportType = DLookup("[ReportName]", "qryAllReports",
"[ReportNumber]='" & cboReportNumber.Value & "'")
Select Case strReportType
Case "ExpenseReport"
grpReportName.Value = 1
Case "TravelExpenseReport"
grpReportName.Value = 2
Case "Purchase Requisition"
grpReportName.Value = 3
Case "CheckRequest"
grpReportName.Value = 4
End Select
' Synchronise ReportNumber combo with existing ReportNumber
cboReportNumber.RowSource = "SELECT qryAllReports.ReportNumber " & _
"FROM qryAllReports " & _
"WHERE tblReportType.ReportName = '" & strReportType & "' " & _
"ORDER BY [cboReportNumber];"
End Sub
Thanks in advance.
by Martin Green at www.fontstuff.com CascadingListDemo4. After days or work,
I cannot get it to work properly. I am not using a table for the
ReportNumbers, but am using a union query "qryAllReports" that list all of
the Report Numbers from 3 separate tables. I have gone around and around
until I am so confused I don't know where I have gone wrong. Can anyone help?
Private Sub grpReportName_AfterUpdate()
On Error Resume Next
Dim strReportType As String
Select Case grpReportName.Value
Case 1
strReportType = "ExpenseReport"
Case 2
strReportType = "TravelExpenseReport"
Case 3
strReportType = "Purchase Req."
Case 4
strReportType = "CheckRequest"
End Select
cboReportNumber.RowSource = "Select qryAllReports.ReportNumber " & _
"FROM qryAllReports " & _
"WHERE tblReportType.ReportName = '" & strReportType & "' " & _
"ORDER BY qryAllReports.ReportNumber;"
End Sub
Private Sub Form_Current()
On Error Resume Next
Dim strReportType As String
If IsNull(cboReportNumber.Value) Then
grpReportName.Value = Null
End If
' Synchronise ReportType combo with existing ReportNumber
strReportType = DLookup("[ReportName]", "qryAllReports",
"[ReportNumber]='" & cboReportNumber.Value & "'")
Select Case strReportType
Case "ExpenseReport"
grpReportName.Value = 1
Case "TravelExpenseReport"
grpReportName.Value = 2
Case "Purchase Requisition"
grpReportName.Value = 3
Case "CheckRequest"
grpReportName.Value = 4
End Select
' Synchronise ReportNumber combo with existing ReportNumber
cboReportNumber.RowSource = "SELECT qryAllReports.ReportNumber " & _
"FROM qryAllReports " & _
"WHERE tblReportType.ReportName = '" & strReportType & "' " & _
"ORDER BY [cboReportNumber];"
End Sub
Thanks in advance.