473,473 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Access 2003/ VBA form filter problem

37 New Member
I have created a form which I want to launch from VBA. I tested the form in the Access UI and was able to roll through the table contents, editing and adding as required.

I then added the following line to another form to call the form:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FAso", , , "[DS]='" & Me.DN & "'", , , Me.DN
The form correctly launched a few times but now it will not. Further, when I now open the form in the UI, it does not show any records until I select RECORDS/ REMOVE FILTER, even though there is no filter set in the property and FLTR is not shown in the status bar.

I checked the status in VBA ON FORM OPEN using:
Expand|Select|Wrap|Line Numbers
  1. Debug.Print "Me.Filter is ", Me.Filter >> “”
  2. Debug.Print "Me.FilterOn is ", Me.FilterOn >> “false”
Is appears as though a filter is permanently set. I ran the compact and repair but no change.

Can anyone help?
Feb 21 '10 #1
3 5413
NeoPa
32,556 Recognized Expert Moderator MVP
When your code is put in side the code tags it becomes clear why the debug code would give invalid results.

I suspect your filtering is related to saving the form at some stage after a filter has been applied. See what happens if you remove the filter (Records / Remove Filter) then save the form (not the data). Will it work correctly afterwards.

To see what the Filter & FilterOn property values are, simply use :
Expand|Select|Wrap|Line Numbers
  1. Debug.Print Me.Filter, Me.FilterOn
Welcome to Bytes!
Feb 21 '10 #2
garfieldsevilla
37 New Member
Thank you- the form now works.

Launching the form with DoCmd.OpenForm "FAso", , , "[DS]='" & Me.DN & "'" results in the form’s filter field being set to the results of "[DS]='" & Me.DN & "'" while the form is active. If there is a problem with the VBA in the form and you correct and save the code, the filter field is set to whatever was in there when the error occurred.

The problem is that when you launch a form with the filter set in this way, FLTR does not show in Access. If you open the Form in design, change the property, save, and open again the filter property remains- it is impossible to change the filter field in the property! The only way to remove the filter is open in the UI, RECORDS/ REMOVE FILTER, and then save.

To avoid this problem during development and to ensure nothing strange might happen once the DB goes live, I am now passing the filter field as an argument using this code in ON OPEN:

Me.FilterOn = True
Me.FilterOn = False
Me.Filter = "DN='" & Me.OpenArgs & "'"
Me.FilterOn = True

Regards
Feb 22 '10 #3
NeoPa
32,556 Recognized Expert Moderator MVP
A new question has been moved to its own thread - How do I Stop Users Saving Over a Form Design.
Mar 10 '12 #4

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

Similar topics

4
by: DeanL | last post by:
Hi All, Having a problem developing an Access 97 database in Access 2003. The database needs to go out to a number of staff who will review it and recommend any changes but when I convert the...
1
by: brownr9 | last post by:
Hello, We're new to Access 2003 programming, and we are developing a database for our church. We built the database from the IMPORT of a Excel spreadsheet. Now we are trying to write a FORM...
11
by: BobBanks | last post by:
Hi, Im making a db for my company in Access 2003 usin xp sp2. Ive created an orders form that has a subform in it. The Order form (parent(is linked to a Orders Qry)) and the Orders Subform...
3
by: rhobson2 | last post by:
Hello, I wrote a database applicaiton using Access XP (2002) and everything has been working good for the client until they purchased a couple of new computers with Access 2003. The meetings...
1
by: dohminator | last post by:
Hello Experts, I have two systems written in Access 2003 that I'm in the process of merging. A user will be given a specific screen depending on his user name. I have a form (let's call it...
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 '...
4
by: ilikebirds | last post by:
This may be a dream. However I was wondering if the following scenario were possible within an Access 2003 Form. If I have to fields and , both of which are have limited field sizes of 4, Would...
4
by: Sheree | last post by:
I have some Access 2003 VBA code that looks like this: Private Sub SubName() Me.FilterOn = True Me.Filter = "" ' Me.FilterOn = False ' Me.Requery x = msgbox("Filter Cleared. Number of...
1
by: PW | last post by:
I have a client who decided to Add/Remove Programs that haven't been used. Besides Microsoft Works 2002, I'm not sure what else she removed. When she opens up our Access 2003 MDE application, she...
1
by: haroonahmad | last post by:
I would really like to have the form come up locked, and then the user unlock it for changes, and then lock it again. I'm using Access 2003. I have no idea how to do it, but have seen it. ...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.