473,413 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Override form recordsource with filter

How does a form's FILTER criteria work? If I specify a query in the form's recordsource, and then in VBA specify a form filter criteria, does the filter criteria override what was originally specified in the recordsource query?

For example, in the form's recordsource, I have specified: SELECT * FROM tblA WHERE Account='12345'. Later in VBA code, I specify filter = "Account='98765' filteron=true. Should the vba override the recordsource?

What if I specify a criteria for the filter that's not in the recordsource? Does it get appended to the recordsource, or replace the WHERE clause in the recordsource.

I can't seem to prove anything one way or another, but I know that my recordsource isn't working right when I add the filter specification.

Thanks,

Gerry Goldberg
Jul 16 '10 #1
1 4440
OldBirdman
675 512MB
VBA doesn't override anything. VBA allows you to set properties of objects, as well as manipulating objects.
Your object here is a form. The property RecordSource you are setting to "SELECT * FROM tblA WHERE Account='12345'". I would assume that this means that you have a RecordSource consisting of one record.
The Filter property of a form applies that filter to the form's RecordSource property. In this case, the result will be an empty recordset. I would expect errors such as 'No current record'.
If you are always going to 'know' the Account, then RecordSource = tblA would work, and the record shown would be the one specified with Filter = '12345' or Filter = '98765'.
Jul 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Patrick Gonzalez | last post by:
Is it possible to use the built-in filter functions (ie. "Filter by Selection", etc..) when a form's recordsource has been set to a recordset object during the load event. When I try to do this, I...
1
by: Steve Miles | last post by:
I've got a form with a combo box and begin/end dates. When any of the three are changed I set a subform's recordsource so the records returned are filtered based on the three fields. The syntax...
2
by: Lauren Quantrell | last post by:
I am using a stored procedure as the recordsource on an MS-Access2000 form: Forms!frmName.RecordSource = "dbo.myStoredProcedure" The stored procedure creates a temp table #Contacts and then...
1
by: Sunil Korah | last post by:
I am having some trouble with opening recordsets. I have used code more or less straight from the access help. But still I am getting some errors. I am unable to work out what exactly I am doing...
2
by: cefrancke | last post by:
I have a form (no underlying record set) that has two separate sub-forms on it. Each sub-form has data from two different tables. Above each sub-form there is one unbound combo box with a SQL...
3
by: Alan | last post by:
I'm having brain fade today... Can the recordsource in a Form's properties do more than one select statement based on criteria? On a popup subform I'm trying to display matching records from a...
7
by: Alan | last post by:
With earlier help from this group (thanks Ben!) I've ended up with this OnLoad code for my popup form: Private Sub Form_Load() If IsNull(!!) = True Then Me.RecordSource = "SELECT .* FROM WHERE...
5
by: abolos | last post by:
Hi, I have an unbounded form with an unbounded text box. In the event On Open I have this code: Form.RecordSource"select last(kmprice) from tblmilageprice". The question is: How can I fill the...
2
by: fastPace | last post by:
I created an SQL statement, left joining three tables. When I use the statement as the recordsource for my form in datasheetview, I cannot input data into any of the fields. Can anyone help me with...
2
by: franc sutherland | last post by:
Hello, I am using Access 2003. I have a query which shows a list of club meetings sorted by date. This query is displayed in continuous forms, in a subform. I would like to select a month on...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.