By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,625 Members | 1,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,625 IT Pros & Developers. It's quick & easy.

Specific Form Filtering Techniques

P: n/a
Okay, I have worked on this and then some, but cannot seem to crack
it. So if someone can straighten my code out, or suggest a new
approach, then I'm all ears.

Here goes: I have two tables - one (tblReports) with all of the fields
appearing on a report selection form (frmReports). The other one
(tblGroup) is only use for the eight group types that I'm trying to
use as a filter. The tblGroup is hooked to the tblReports Group field
(rptType). When I open the combo box (cboEight) on the form, I see the
8 groups listed, and also in the list box (lboList), I see "all
groups" of the reports listed (rptName).

Now, what I want to do is simply have a little code on the OnOpen
event of the report selection form that enables the filter (if used -
no filtering if not) to only show the related reports under the
selected group. So far - no go. Here is one piece of code that I used,
but it triggered Error 2448 - can't assign a value to this object. Of
course, I got a couple of different errors after tweaking it. The
code: Me.Filter = "rptType = " & Form_frmReports.cboEight.Value
Me.FilterOn = True
I also used rptName in lieu of rptType - same error message. What do
you think?

Thanks in advance for showing me "where" I missed it. Dalan
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dalan,

After the form is open, when the user chooses a group from the combo
box cboEight, dynamically change the RecordSource property for the
form to an sql statement that will select only reports for the group
chosen. Do this in the On Click event for the combo box.

Code Sample:

Private Sub cboEight_Click()

If Not IsNull(Me.cboEight) Then
Me.RecordSource = "SELECT * FROM tblReports WHERE [rptType] =
'" & Me.cboEight & "'"
End If

End Sub

Changing the RecordSource property will cause the recordset underlying
the form to be requeried automatically. I hope I understood your
question correctly and I hope my response helps.

Mike Pace
M. L. Pace Computer Consulting
Mobile, Alabama

ot***@safe-mail.net (Dalan) wrote in message news:<50**************************@posting.google. com>...
Okay, I have worked on this and then some, but cannot seem to crack
it. So if someone can straighten my code out, or suggest a new
approach, then I'm all ears.

Here goes: I have two tables - one (tblReports) with all of the fields
appearing on a report selection form (frmReports). The other one
(tblGroup) is only use for the eight group types that I'm trying to
use as a filter. The tblGroup is hooked to the tblReports Group field
(rptType). When I open the combo box (cboEight) on the form, I see the
8 groups listed, and also in the list box (lboList), I see "all
groups" of the reports listed (rptName).

Now, what I want to do is simply have a little code on the OnOpen
event of the report selection form that enables the filter (if used -
no filtering if not) to only show the related reports under the
selected group. So far - no go. Here is one piece of code that I used,
but it triggered Error 2448 - can't assign a value to this object. Of
course, I got a couple of different errors after tweaking it. The
code: Me.Filter = "rptType = " & Form_frmReports.cboEight.Value
Me.FilterOn = True
I also used rptName in lieu of rptType - same error message. What do
you think?

Thanks in advance for showing me "where" I missed it. Dalan

Nov 12 '05 #2

P: n/a

Use the Load event instead of Open

Good luck,

Dan

Originally posted by Dalan
Okay, I have worked on this and then some, but cannot seem to crack it. So if someone can straighten my code out, or suggest a new approach, then I'm all ears. Here goes: I have two tables - one (tblReports) with all of the fields appearing on a report selection form (frmReports). The other one (tblGroup) is only use for the eight group types that I'm trying to use as a filter. The tblGroup is hooked to the tblReports Group field (rptType). When I open the combo box (cboEight) on the form, I see the 8 groups listed, and also in the list box (lboList), I see "all groups" of the reports listed (rptName). Now, what I want to do is simply have a little code on the OnOpen event of the report selection form that enables the filter (if used - no filtering if not) to only show the related reports under the selected group. So far - no go. Here is one piece of code that I used, but it triggered Error 2448 - can't assign a value to this object. Of course, I got a couple of different errors after tweaking it. The code: Me.Filter = "rptType = " & Form_frmReports.cboEight.Value Me.FilterOn = True I also used rptName in lieu of rptType - same error message. What do you think?


Thanks in advance for showing me "where" I missed it. Dalan

--
Posted via http://dbforums.com
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.