472,783 Members | 885 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,783 software developers and data experts.

Specific Form Filtering Techniques

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
2 3586
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside...
0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
0
by: Keith Shearer | last post by:
I'm having a bit of trouble, moving between controls, when filtering on a form. I'm using a continuous form. At the top I have 2 date fields. I want to filter the data specified between the two...
5
by: Richard | last post by:
Hi, I have a form that take some time to load due to many comboboxes and at least 8 subforms. When I filter or sort the main form I get an error message and then Access shuts down. They ask if...
3
by: Cagey | last post by:
What I'm trying for: If this selection or if click on selection (highlighted line choice/ which ever selection change) w/in query's combo dropdown list box (on Switchboard), then Open in...
7
by: Katherine | last post by:
I'm trying to filter the records on the mainform (MailingList) of my database using a field contained in a subform (Donations). I was basing my code off Allen Browne's Access Tips page (here:...
0
by: Yarik | last post by:
Hello, Here is a sample (and very simple) code that binds an Access 2003 form to a fabricated ADO recordset: ' Create recordset... Dim rs As ADODB.Recordset: Set rs = New ADODB.Recordset '...
0
by: Lyn | last post by:
I have a problem using the form .Filter and .FilterOn properties which causes Access to crash (as detailed in a separate post). The form operates in continuous mode, displaying matching records...
4
by: dizzydangler | last post by:
Hi all, I am a new Access user and just starting to get my head around some of the basic concepts, so please take it easy on me :) My company has been managing client records on excel, and I’m in...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.