R
ryguy7272
I am trying to program a Form with a Row Source linked to:
SELECT Sheet1.ID, Sheet1.PROD FROM Sheet1;
This does not crash Access, but if I change the Row Source to this:
Sheet1
Access will crash.
I can't see any other data sources listed under Row Source. What do I need
to do to access the correct Row Source?
The name of the ComboBox is 'cboStatus' and the code that I am using is
listed below:
Option Compare Database
Option Explicit
Private Sub cmdApplyFilter_Click()
Dim strBroker As String
Dim strProd As String
Dim strStatus As String
Dim strFilter As String
' Check that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "rptStaff") <>
acObjStateOpen Then
MsgBox "You must open the report first."
Exit Sub
End If
' Build criteria string for Broker field
If IsNull(Me.cboBroker.Value) Then
strBroker = "Like '*'"
Else
strBroker = "='" & Me.cboBroker.Value & "'"
End If
' Build criteria string for Product field
If IsNull(Me.cboProd.Value) Then
strProd = "Like '*'"
Else
strProd = "='" & Me.cboProd.Value & "'"
End If
' Build criteria string for Status field
If IsNull(Me.cboStatus.Value) Then
strStatus = "Like '*'"
Else
strStatus = "='" & Me.cboStatus.Value & "'"
End If
' Combine criteria strings into a WHERE clause for the filter
strFilter = "[Broker] " & strBroker & " AND [Prod] " & strProd & " AND
[Status] " & strStatus
' Apply the filter and switch it on
With Reports![rptStaff]
.Filter = strFilter
.FilterOn = True
End With
End Sub
Private Sub cmdRemoveFilter_Click()
On Error Resume Next
' Switch the filter off
Reports![rptStaff].FilterOn = False
End Sub
I got the code from here:
http://www.fontstuff.com/access/acctut19.htm
I am making some modifications to try to create a new way of reporting
(currently use Excel) for out department.
It must be something fairly simple...just can't seem to figure it out...
Regards,
Ryan---
SELECT Sheet1.ID, Sheet1.PROD FROM Sheet1;
This does not crash Access, but if I change the Row Source to this:
Sheet1
Access will crash.
I can't see any other data sources listed under Row Source. What do I need
to do to access the correct Row Source?
The name of the ComboBox is 'cboStatus' and the code that I am using is
listed below:
Option Compare Database
Option Explicit
Private Sub cmdApplyFilter_Click()
Dim strBroker As String
Dim strProd As String
Dim strStatus As String
Dim strFilter As String
' Check that the report is open
If SysCmd(acSysCmdGetObjectState, acReport, "rptStaff") <>
acObjStateOpen Then
MsgBox "You must open the report first."
Exit Sub
End If
' Build criteria string for Broker field
If IsNull(Me.cboBroker.Value) Then
strBroker = "Like '*'"
Else
strBroker = "='" & Me.cboBroker.Value & "'"
End If
' Build criteria string for Product field
If IsNull(Me.cboProd.Value) Then
strProd = "Like '*'"
Else
strProd = "='" & Me.cboProd.Value & "'"
End If
' Build criteria string for Status field
If IsNull(Me.cboStatus.Value) Then
strStatus = "Like '*'"
Else
strStatus = "='" & Me.cboStatus.Value & "'"
End If
' Combine criteria strings into a WHERE clause for the filter
strFilter = "[Broker] " & strBroker & " AND [Prod] " & strProd & " AND
[Status] " & strStatus
' Apply the filter and switch it on
With Reports![rptStaff]
.Filter = strFilter
.FilterOn = True
End With
End Sub
Private Sub cmdRemoveFilter_Click()
On Error Resume Next
' Switch the filter off
Reports![rptStaff].FilterOn = False
End Sub
I got the code from here:
http://www.fontstuff.com/access/acctut19.htm
I am making some modifications to try to create a new way of reporting
(currently use Excel) for out department.
It must be something fairly simple...just can't seem to figure it out...
Regards,
Ryan---