Hi, Ive been working on an Access database for over a month now and I have had some trouble with creating a search button, and making it work. I can create the button but for some reason it stil does not work. Both me and my boss have been through the coding numerous times and cannot find what is wrong.
Does anybody know the coding to create a successful search button in Access 2003???
Any information will be greatly appreciated thank you
Jenny
6 2892
Hi, and Welcome to Bytes!
It would help us if you could post the code you have at present, and advise us of the names of the fields and controls concerned - we know nothing about your database other than what you tell us, and since you have not told us anything about what it is you are searching upon it is very difficult to advise you.
I have retitled your post to a more meaningful title - 'Help!!!' does not direct readers to what you want help with...
-Stewart
Ok thanks for replying, below is the code I have for the search button. There are feilds named, BMS ID, Name, Lot#, Storage Location, Date Recieved, amount Recieved, Measure, Expiry date all in the Compound List table. I want a search button on the Compound Information form searching the first four feilds of all compounds in Compound List table.
I hope this helps you understand more
The code:
Thanks very much
Jenny x x
Hard to tell in 116 lines of code. Anyways, the first comment I have is that I think it's a complicated way to do something relatively simple - and the simplest way is to apply a filter to the form concerned. A filter comprises the WHERE clause of an SQL statement (just as you have at present) but without the WHERE. You could then just apply the filter instead of changing the recordsource for your subform - using - Forms![subformname].Form.Filter = <yourSQLWhereClauseStringWithoutWhere>
-
Forms![subformname].Form.Filteron = True
I am not sure where you are currently going wrong. One error is that the Refresh method is not the correct one to apply to update the recordsource of a form; use the Requery method instead.
In debugging what you currently have, if you continue to have problems you should set a breakpoint at the start of the code at step through it a line at a time, viewing the values of all local variables as you go. In particular, check that the SQL statement is correctly formed - you should be able to copy it into an Access query to check that the SQL delivers the results you expect.
-Stewart
NeoPa 32,556
Expert Mod 16PB
In case it helps, Debugging in VBA tells you had to do some basic debugging (setting breakpoints, stepping through code, etc).
thank you I've got it working now! all your help was very much appreciated! Thanks again
Jennyx x x
NeoPa 32,556
Expert Mod 16PB
Good for you Jenny.
I hope you managed to get into some debugging. That can be such a useful tool in your arsenal.
Welcome to Bytes!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: D. Dante Lorenso |
last post by:
Trying to use the 'search' in the docs section of PostgreSQL.org
is extremely SLOW. Considering this is a website for a database
and databases are supposed to be good for indexing content, I'd...
|
by: Steph |
last post by:
Hi.
I'm very new to MS Access and have been presented with an Access database
of contacts by my employer.
I am trying to redesign the main form of the database so that a button
entitled...
|
by: Pete |
last post by:
Is there any way to change the default search to "Any Part Of Field"
instead of whole field? The first thing I ever do when searching for
something in a field is change the default setting from...
|
by: ljungers |
last post by:
I'm on the home streach of my project and found that my "Reset for New Search" command button not working as desired. What should happen is that when the button is clicked a Event Procedure is run....
|
by: Chris |
last post by:
I need a search form to perform. I have a Form and a subform. The
subform is based off a query and the main form is unbound. The query
runs perfect, however, I have a command button in the main...
|
by: Mark |
last post by:
Hi All,
I am creating a music database for a friend and have run into a problem.
Within the ALBUM table, I wanted to store the ARTIST_ID rather than the
ARTIST_NAME. To do this, I intended to have...
|
by: MNNovice |
last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below.
Table 1 tblMusicCategory
Field 1: MusicCategoryID - Auto Number (PK)
Field 2:...
|
by: JamesOo |
last post by:
I have the code below, but I need to make it searchable in query table,
below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only,...
|
by: Mark112 |
last post by:
Hi
I am attempting to restore the search feature that was created by an external company using the indexing service for our intranet.
the intranet is located locally at each of our offices. The...
|
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,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |