473,387 Members | 1,374 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.

Microsoft Access Searchbox

(1) I have a Table called Account table [ ID, ACCode, ACName, Date]
(2) a form called Account form
(3) a sub-form called Account subform –Record Source to Account Table
(4) Account form is single form with Account subform

In Account Form

 I have a Search box - txtSearch
 A command button cmdSearch
 cmdSearch – onclick event got the following code :

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSearch_Click()
  2. Dim bkmk As Variant
  3.     Dim strField As String
  4.     Me.RecordsetClone.MoveFirst
  5.     'Find the first record that matches what
  6.     'is in the search text box.
  7.     Me.RecordsetClone.FindFirst "ACName Like " & Chr(34) & Me.txtSearch & "*" & Chr(34)
  8.  
  9.     If Me.RecordsetClone.NoMatch Then
  10.                 MsgBox " Sorry! No match found for  [" & Me.txtSearch & "], Try another ", vbOKOnly + vbInformation, "Sorry"
  11.  
  12.     Me.txtSearch.SetFocus
  13.     Else
  14.         bkmk = Me.RecordsetClone.Bookmark
  15.         Me.Recordset.Bookmark = bkmk
  16.     End If
  17.      Me.txtSearch = ""
  18. End Sub

This code works to fine search single record. I can find any single item either ID, or ACCode or Date. Message also works if no match found. Even just put one word, two word …or whole word.
But I want to search multiple records from the same box (txtSearch).
(1) Actually I want to put multiple criteria in here - Me.RecordsetClone.FindFirst "ACName Like " & Chr(34) & Me.txtSearch & "*" & Chr(34) So that it can find either ID or ACCode or ACName
(2) Another thing is –If no item put the search box it will show a message “No search item has detected”

OR
is it possible to do by access Macro with this feature? I tried and three search criteria working but I couldn’t fixed other issue such as “No match found” or “No search item detected”
Can anyone help me please?

Thanks
Mar 2 '14 #1
1 1382
The AccountSubform is a datasheet form?
If so, can't you use a filter?
Something like:
Expand|Select|Wrap|Line Numbers
  1. DoCMD.ApplyFilter "FilterName", "[AccountTable].[ACName] LIKE '*" & [txtSearch].[Value] & "*'", "The name of your subform control"
  2.  
Mar 3 '14 #2

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

Similar topics

27
by: Chuck Grimsby | last post by:
(Repost, due to lack of submissions...) The Microsoft Access Product Group (the people who build Microsoft Access) want your help! One of the main things we're working on for the near future...
8
by: Larry__Weiss | last post by:
What kind of licensing is needed to be able to use the Microsoft Access product and distribute the applications? In other words, what version of Microsoft Access does a developer need to buy in...
6
by: Null Reference | last post by:
Anybody here who can explain or point me to a link ? I wish to create a blank MS Access DB file programmatically using C# . Thanks, nfs
17
by: Pam Ammond | last post by:
I need to use Microsoft Access Automation within a Visual Studio 2003 program written in C# for Windows Forms. When a button is clicked in my VS.NET program, I want it to run a Microsoft Access...
4
by: bbdobuddy | last post by:
Hi, How do I open a Microsoft Access 2003 form from Visual Basic.net Thanks in advance bbdobuddy
1
by: somersbar | last post by:
hey, ive been trying to set up a web form in visual basic.net that can access a microsoft access database. i need to use odbc also. i can get it working using a windows form but not a web form....
5
by: somersbar | last post by:
hello all, im trying to connect to a microsoft access database from an ASP.NET web form. i keep getting the following error though: ERROR Could not use '(unknown)'; file already in use....
0
by: bazzer | last post by:
hey, i am using visual basic.net 2003 and have an ASP.NET webform application thats accessing a microsoft access 2003 database. i kept getting the following error when i tried to run it: ERROR ...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
3
by: ipellew | last post by:
Hi; I 'e been developing a little application based on MS Access (I am usually in Informix) and have to say the Web is full of sites that offer little in the way of help. I have to say that...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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...
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
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...

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.