473,698 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search Form Code

f430
43 New Member
hi, i have a master table with all my part information, and it has columns with part number, date, defects,...
and i am trying to write a code for my search form.
i have created a search form on Access, and it has 5 combo boxes for:
part number
defects
assembled by
and the other 2 combo boxes are for "from" and "to" date range. i have made the combo boxes for the date range to display a calendar when clicked and choose a date.

i have been trying to write a code that only requires one of these fields to be filled out and it can filter my master table.
i would appreciate any help on this
Thanks
Aug 9 '10
61 3734
Michael Adams
55 New Member
If you two do not mind my input, here it is.
I have a "Search Form" that asks the user for given information, either user input or selection from a combo box. I then search the "Literial" string from the "Search Form" and compare it to the Master Table. If there is a match between the Search Form and the Master Table the results are populated to a new form that shows all the information in the (single/multiple) records from the table. This "Display Form" has text boxes that are controled by the master table that it is linked to.
You can follow the progression from question to answer in the following post:
http://bytes.com/topic/access/answer...ed#post3594080

As to your getting the "Parameter" box, as you will note in the post we also recieved those but the final code eliminated the pop up and returned the correct records.

Thanks for letting me post to this post, and I hope it helps.

I am working on the searching the from date and the to date also, should be fairly easy now that I have this code.
I will be posting that code in the other post tomorrow, but will also post here if you like.

Thanks, MJA
Aug 11 '10 #21
NeoPa
32,569 Recognized Expert Moderator MVP
You're welcome to jump in of course Michael. I wouldn't recommend linking across to that thread though. The OP is at a very basic level and the thread rambles on for ever with very little progress.

You, on the other hand, seem to have a bit more experience, so I'd point you to the article I linked to in post #2 of this thread. You may find it answers some of your questions.
Aug 11 '10 #22
f430
43 New Member
I apologize about that again. i just thought starting a new code would maybe eliminate some of the errors i had. but i will just stick with the old code.
i will provide the master table detail below
ID: AutoNumber
CreationDate: Date/Time
Part Number: Number
Defect Code 1: Text
Defect Code 2: Text
Defect Code 3: Text
Associate: Text
Associate 2: Text

i will try out my code and let you know.
Thank you for your help
Aug 12 '10 #23
Michael Adams
55 New Member
Might I suggest that you do one piece at a time? For instance just create a real quick form with a single text box for your part number and put a command button on that same form. Use the command button wizard to open your final form with the information you want diplayed after the search.

Thanks,
MJA
Aug 12 '10 #24
NeoPa
32,569 Recognized Expert Moderator MVP
Thank you for this post. I now know I'm not working in a vacuum. I feel better already.

This confirms my guesses, so I would be interested in hearing if the code I suggested in post #20 works for you. It should do.

If it does fail, can you say what you see, giving line numbers and/or error codes. That would be a great help.
Aug 12 '10 #25
f430
43 New Member
i got a error message saying that i was missing a ), or ].
but i spotted the missing one and added it for both the associate and the defect code
Expand|Select|Wrap|Line Numbers
  1.  If Not IsNull(Me.associateid) Then _
  2.        strFilter = strFilter & " AND " & _
  3.           "('" & Me.associateid & "') In([Associate]," & "[Associate 2])"
but now whenever i try to search for the defect code, or the associate, it asks me to enter the parameter value for defect code 3, associate, and associate 2. if i don't enter in any data and cancel, i get run-time error '2001' "you canceled the previous operation". i then go to debugging and it highlights
Expand|Select|Wrap|Line Numbers
  1.  Me.Filter = strFilter
i tried debugging and whenever i move below the code above, it gives me an error msg saying run-time errot '3075' syntax error (missing operator) and it refers to the defect and associate code.

also whenever i try to search using either the date or the part number, nothing seems to happen.
Aug 12 '10 #26
NeoPa
32,569 Recognized Expert Moderator MVP
Good attempt :) You had the right idea, but the wrong place to put it.

Here is a fixed version of one of them. I'm sure you can fix the other yourself.
Expand|Select|Wrap|Line Numbers
  1.  If Not IsNull(Me.associateid) Then _
  2.        strFilter = strFilter & " AND " & _
  3.           "('" & Me.associateid & "' In([Associate],[Associate 2]))"
NB. You don't need to concatenate two simple strings together if they're on the same line. You can just make it a longer string.

Let me know how you get on with this after you've fixed both in your code.
Aug 12 '10 #27
f430
43 New Member
after i fixed the code, and try to search, it keeps asking me to enter parameter values for the following:
defect code 3
associate
associate 2
and i went into my code and created a breakpoint at the code provided in post #26 (the second one)
and when i run the filter through it it gives me run-time error '3075' syntax error (missing operator) for both the associate and the defect code.
now im really confused.

Thank You
Aug 12 '10 #28
Michael Adams
55 New Member
Try this, create a variable for each. Then use this code after your dim statements.

Expand|Select|Wrap|Line Numbers
  1. If Not isnull(Me.your text/combo box that holds your literial string) Then 
  2. your variable here = "[field on table]=""" & Me!your text/combo box that holds your literial string & """"
This should match the literal string from your filter and the string your table holds.

Now after this statement your variable will now hold the exact match on your table, you will need to call this variable in the correct place.

If this is confusing maybe NeoPa can help straighten it out. What I think is happening is that you have more than one unique entry in each field you are searching, that is why it is asking you for parameters. I believe you will find it working if you input the same string into the parameters that you input into each text box on your filter.

This is why I always work on one piece of code first. It makes debugging problems much easier and also makes the coding process less confussing(less thing to go wrong).

Just a thought.
MJA
Aug 12 '10 #29
NeoPa
32,569 Recognized Expert Moderator MVP
Why don't you post the whole, exact (Copy / Paste) procedure in here and I'll look at it for you. I need to see what you're using to work out what might be wrong as I know you're not using my code as I posted it from your other posts (though why that is, at this stage, is beyond me I must admit).
Aug 12 '10 #30

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

Similar topics

7
3177
by: jim Bob | last post by:
Hi, This is probably very simple to do so if anyone can point me to the right place for reading, it would be much appreciated. I just want to build a very basic search form where i can enter a name or part of a name into a text box, press a button, and the entered value gets inserted into a sql query and the results of the query gets displayed into a list or text box. (ie take the input from the text box and plug that variable in my...
3
2213
by: Sheau Wei | last post by:
This is the search engine code that i create, but it was error and didnt come out the result. Cn u help me to check what wrong with my code? Thanks <Table cellspacing=1 cellPadding=1 align=center> <td colspan=4> <h2 align=center>Bomba inventory searching system</h2> <tr> <td> <h4 Balai Bomba Inventory Searching System</H4> <form name="search" method="post" action="<?=$PHP_SELF?>">
31
2938
by: DWolff | last post by:
I'm somewhat new to Access, and have no VB experience at all (except for modifying existing code where obvious). I built a data entry form that works fine. Typically, a client will call in and the user has to find his record to add or modify existing data. Originally, I built the form based on a query with an input criteria for the last name and first name. The Last_Name critera is Like &"*" so that partial names will work. The...
9
16094
by: lightning | last post by:
Hi all, I'm not very conversant with the vocabulary of Access, so please ask for clarification if necessary... I am trying to build a search form that allows combinations of search terms. For example, let's say I have three controls on my form; year, keyword, location. Entering a valid value for all three gives expected results from the dataset. However, I'd like to interpret a blank field in the search form as ignoring that constraint....
6
2426
by: KiwiGenie | last post by:
Hi..I am trying to make a search form. I am fairly new to access and could well be looking at it completely wrong. I have an unbound form with textboxes in the header for entering different search criteria. I have a subform for displaying the results, which is bound to Query4. SQL for Query4 (taken from sql view in query): SELECT tblRecipes.RecipeName, tblRecipes.FoodCategory, Sum(Query3.IngredCost) AS SumOfIngredCost, Query3.RecipeID FROM...
2
2264
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 have a command button on the album form which would open a search form (based on the artist table). This works as I wanted and allows me to get to one record. I then planned to have a button on the search form which when clicked, would updated...
2
2745
by: woodey2002 | last post by:
Hi Guys and thanks for your time. I have a search form for my database that allows users to select multiple criteria from multi select list boxes. I successfully integrated a multi select listbox for users to select and search for counties. On the same page however I would like to integrate a similar multiselect box for nationality. I would like the user to be able to search for nationality with county or individually. After...
6
4666
by: woodey2002 | last post by:
Hi Everyone. Thanks for your time. I am trying to create a search form that will allow users to select criteria from multiple multi select boxes. So far i have managed to achieve a search option for 2 list boxes:- county and nationality, while trying to add a third multi select list box for qualifications search is where i encounter my problem. I've copied the working code from my working list boxes, however it cant seem to pick up the...
6
3570
by: mercout | last post by:
Hey, I've been trying to create a search form in access for a while now, searching through books and emails. I have the search form set up with 11 combo box's, 3 text box's, a view button, and a clear button. Once the user enters certain fields, all of the boxes do not have to be filled and clicks the view button, a report will pop up with detail of what was found.I found this code...
8
4526
by: munkee | last post by:
Hi everyone, I am using the following code adapted from Allen Browne: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few criteria as they wish, _ and results are shown one per line. 'Note: Only records matching ALL of the criteria are returned. 'Author: Allen Browne (allen@allenbrowne.com), June 2006. Option Compare Database
0
8683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.