473,396 Members | 2,061 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,396 software developers and data experts.

Search function help

111 100+
Hey guys,

I have a form that is used solely as a search page. It allows the user to enter either a GroupName or GroupNumber in 2 different text boxes with a button under each one. the OnClick property of the buttons is coded to match either the GroupName or GroupNumber and open a new form with the appropriate data. The search function itself works fine, but my problem is that whenever someone searches for a name or number, it is storing those values in the table. Is it possible to not store these values? Is my design all wrong?
Aug 14 '07 #1
10 1535
JKing
1,206 Expert 1GB
Could you post the code for the Onclick events? This would help us in narrowing down the problem. Thanks.
Aug 14 '07 #2
Neekos
111 100+
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command47_Click()
  2. On Error GoTo Err_Command47_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmMainGroup"
  8.     DoCmd.RunCommand acCmdWindowHide
  9.     stLinkCriteria = "[GroupNumber]=" & "'" & Me![GroupNumber] & "'"
  10.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  11.  
  12. Exit_Command47_Click:
  13.     Exit Sub
  14.  
  15. Err_Command47_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_Command47_Click
  18.  
  19. End Sub
  20.  
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command48_Click()
  2. On Error GoTo Err_Command48_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmMainGroup"
  8.     DoCmd.RunCommand acCmdWindowHide
  9.     stLinkCriteria = "[GroupName]=" & "'" & Me![GroupName] & "'"
  10.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  11.  
  12. Exit_Command48_Click:
  13.     Exit Sub
  14.  
  15. Err_Command48_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_Command48_Click
  18.  
  19. End Sub
  20.  
Aug 14 '07 #3
Neekos
111 100+
the problem isnt really with the search function itself, i think its more do with how i have the form set up. the search form has the same RecordSource as the form that i'm opening, which is where its storing these values.
Aug 14 '07 #4
JKing
1,206 Expert 1GB
The search form shouldn't be bound and neither should the combo boxes on the search form.

What you want to do is have two unbound combo boxes that through a query look up the values you want rather than having them as bound controls.
Aug 14 '07 #5
Neekos
111 100+
is it possible to do this without using a combo box? Or have the combo box be data entry only? I dont want the user to have the Drop down capabitlites and be able to see all the different names in the list.
Aug 14 '07 #6
JKing
1,206 Expert 1GB
You can do the same thing with textboxes. The way you have your code setup I believe if you just remove the record source from the search form and the control sources of the textboxes, it should work fine.
Aug 14 '07 #7
Neekos
111 100+
that worked great! such an easy fix!

Now im having the problem of whenever the user opens the search page, the last thing that was searched for is still in the text box. Its unbound so i'm not sure why this is sticking! Any thoughts?
Aug 14 '07 #8
JKing
1,206 Expert 1GB
If they aren't bound this shouldn't be happening. Are you infact closing the search form or just hiding it? Are you setting the default value of the textboxes?
Aug 14 '07 #9
Neekos
111 100+
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acCmdWindowHide
this is my code....so i am in fact just hiding it. Is that the problem? If so, how can i auto close the window?
Aug 14 '07 #10
JKing
1,206 Expert 1GB
You could use Docmd.close to close the search form.

Or if you prefer you could also just clear the textboxes when the user clicks one of the buttons.
Aug 14 '07 #11

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

Similar topics

1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
4
by: Ken Fine | last post by:
I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string, return the highlighted search term along with the...
2
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned...
3
by: Liz Malcolm | last post by:
Hello and TIA for guidance. I am building a reusable search procedure (thanks go to Graham Thorpe for his example that set me on my way). Everything works up until the 2nd match is found, the...
2
by: Scott | last post by:
I'm trying to use the HTMLHelp API calls in a VB.NET program because I want a little more functionality than is offered by the Help class in .NET. Everything works fine except for displaying the...
4
by: BenCoo | last post by:
Hello, In a Binary Search Tree I get the error : Object must be of type String if I run the form only with the "Dim bstLidnummer As New BinarySearchTree" it works fine. Thanks for any...
0
by: xmanofsteel69 | last post by:
I'm trying to create a search function for my site and I can't ever seem to figure it out. If anybody could help, that would be awesome, because everything I try, I keep getting errors... Here's...
3
markmcgookin
by: markmcgookin | last post by:
Hi Folks, I have a VB app, and I have been working at it for a while, and I am now at the stage where I want to create a search function. Now don't be scared! It is in the .Net compact framework,...
0
by: kang jia | last post by:
hi currently i am doing this search function for car booking website. it can search through either car seats or CarModel. it seems it able to do search function, however i small problem occurs to...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
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...
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
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
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,...
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...

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.