473,387 Members | 1,407 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,387 software developers and data experts.

How To Re-Filter Data

68
Hi everyone,

I have a form for departments and personnel. There are there fields for the sake of search:

DepartmentSearch as combo box
Division\UnitSearch as combo box
Number as combo box

the user should selcet values form those and press the button( I 'm usnig Macro) to filter data. So far, everything works fine but when re-select other values to look for other data it doesnt work!! it keeps giving me the same result

How to solve this problem ?
Jun 29 '09 #1
13 3432
MikeTheBike
639 Expert 512MB
@ahd2008
Hi
You have not indicated how you are applying the filter in the first instance, but if the form filtering controls are linked to the Record Source of the form (ie. a Stored Query), them I suggest you insert Me.Requery in the After Update event for the filtering controls.

MTB
Jun 29 '09 #2
ahd2008
68
I'm full of gratitude to you Sir and sorry i didnt provide sufficient details.

the way i do the filter proceess is by using Macro. As i mentioned the user should select the Department and the Division or Unit and its number then click button which run the Macro. Everything goes as planned but when I want to select other department it doesnt work. !! it gives me the same result for the previous search.

Also when i click the Toggle Filter button on the upper side of the window to trun off filter and try again i get the same result. Moreover, I tried Me.Requery but it doesnt work too.

in regard to your question, the filtering controls are not inked to the recourd source

Looking forward to your assistance
Jun 29 '09 #3
MikeTheBike
639 Expert 512MB
@ahd2008
Hi again

I thing it would be usefull if you posted the macro code, we might then be able to be more specific in our reply.

MTB
Jun 29 '09 #4
ahd2008
68
Here you go

I put this code into where condition part of the macro

Expand|Select|Wrap|Line Numbers
  1. [Departments.Department Name] Like [Forms]![Departments and Personnel]![DepartmentSearch] And [Units&Divisions.UDName] Like [Forms]![Departments and Personnel]![UnitDivisionsearch] and [Units&Divisions.Number]=[Forms]![Departments and Personnel]![NumberSearch] 
appreciate your help.
Jun 29 '09 #5
MikeTheBike
639 Expert 512MB
@ahd2008
Unfortunately the line of code posted does not give any clue as to how you are filtered the form originally or how you are trying to re-filter it after changing the filter criteria.

It would be better if you posted the complete Macro/Sub !?


MTB
Jun 30 '09 #6
ahd2008
68
Thanks for your support.

I attached my database now. The way i filter the form i click on the search button to show the hidden fields (Department and Unit\Division) on the form. After that, i fill out the fields and click the search button which includes macro to do filter.

Thanks again
Attached Files
File Type: zip PTDT.zip (725.7 KB, 98 views)
Jul 1 '09 #7
MikeTheBike
639 Expert 512MB
@ahd2008
Hi

Unfortunatly our IT policy will not permit down loading (or opening) files from the internet (as you can imagine this is a great source of frustation!). Therefore, I cannot be of any help unless you post the actual code.

MTB
Jul 1 '09 #8
mshmyob
904 Expert 512MB
This is why I don't like to use macro's. But if you insist then in your search macro just add a REQUERY action after your APPLYFilter line.

For the REQUERY action you do not put in any parameters for the control. (No parameter means to requery the underlying form).

cheers,
Jul 1 '09 #9
ahd2008
68
Sorry to pester you the whole code is already posted besides I explained the way i use the macro.

I dont know what the problem is and thanks for you help all. it seems i cant clearly deliver my concern.

Anyhow, if we could start over and provide me with other method to do search on form by using unbound fields i would appreicate it.
Jul 1 '09 #10
mshmyob
904 Expert 512MB
Maybe you misunderstood me.

Using the code you have all you need to do is REQUERY the form. So in your search macro you add a line at the end to do a REQUERY.

Go into design mode and after your last line you add a requery. In the action column add the command REQUERY. That's it.

cheers,

@ahd2008
Jul 1 '09 #11
ahd2008
68
thanks all for your support and the fruitful suggestions.

it works now i put the code Requery after macro code.

Althoug i know what is the major function of Requery but i'm still curious to know how it programatically makes it work.

I will be more than grateful if you explian this aspect

Thanks again.
Jul 2 '09 #12
mshmyob
904 Expert 512MB
The Requery method does one of the following:

1. Reruns the query on which the form or control is based.
2. Displays any new or changed records or removes deleted records from the table on which the form or control is based.
3. Updates records displayed based on any changes to the Filter property of the form.

The 3rd one applies to your scenario. You were changing the filter property of the form. This won't update your data until you do a requery.

The problem with using the built in Wizard to create your macro's is that the M$ designers cannot take into account every scenario that you may want to implement. You still may need to tweak the macro generated by the wizard. Unfortunately most beginners assume the Wizard is foolproof and can read their minds on what exactly they want done. I think if you really want to learn Access and continue using it for future projects that you learn how to program with it and leave the macro's behind.

Anyways good luck with your project.

cheers,


@ahd2008
Jul 2 '09 #13
ahd2008
68
thanks you a lot. what i was aware of is number 3

Yes i do want to use it for futuer and I'll be more than glad if you enlighten me in how to use better alternative than marco.

Thanks again ,which you marvelous luck.
Jul 3 '09 #14

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

Similar topics

1
by: Nel | last post by:
I have a question related to the "security" issues posed by Globals ON. It is good programming technique IMO to initialise variables, even if it's just $foo = 0; $bar = ""; Surely it would...
4
by: Craig Bailey | last post by:
Anyone recommend a good script editor for Mac OS X? Just finished a 4-day PHP class in front of a Windows machine, and liked the editor we used. Don't recall the name, but it gave line numbers as...
11
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
4
by: Alan Walkington | last post by:
Folks: How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function...
1
by: John Ryan | last post by:
What PHP code would I use to check if submitted sites to my directory actually exist?? I want to use something that can return the server code to me, ie HTTP 300 OK, or whatever. Can I do this with...
10
by: James | last post by:
What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA
8
by: Lothar Scholz | last post by:
Because PHP5 does not include the mysql extension any more is there a chance that we will see more Providers offering webspace with Firebird or Postgres Databases ? What is your opinion ? I must...
1
by: joost | last post by:
Hello, I'm kind of new to mySQL but more used to Sybase/PHP What is illegal about this query or can i not use combined query's in mySQL? DELETE FROM manufacturers WHERE manufacturers_id ...
2
by: sky2070 | last post by:
i have two file with jobapp.html calling jobapp_action.php <HTML> <!-- jobapp.html --> <BODY> <H1>Phop's Bicycles Job Application</H1> <P>Are you looking for an exciting career in the world of...
1
by: Clarice Almeida Hughes | last post by:
tenho um index onde tenho o link pro arq css, como sao visualizados pelo include todas as paginas aderem ao css linkado no index. so q eu preciso de alguns links com outras cores no css, o q devo...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.