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

Text box on a form to search record

We can have an unbound text box on the form in which the person can type in the text box they want to go to retrieve information without having to use the find record button or menu option. For this we can use the After Update event to move to the desired record (please see below code). How can we hide or restrict other records to display in a columnar form as by default it shows entire record one by one? Please help or provide any alternate solution. Thank you.

This example assumes an unbound text box named "txtFindID" where the user enters the number to find:

Private Sub txtFindID_AfterUpdate()
Dim strWhere as String
If Not IsNull(Me.txtFindID) Then
If Me.Dirty Then 'Save first.
Me.Dirty = False
End If
strWhere = "[ID] = " & Me.txtFindID
With Me.RecordsetClone
.FindFirst strWhere
If .NoMatch Then
Msgbox "Not found."
Else
Me.Bookmark = .Bookmark
End If
End With
End If
End Sub

Note: If "ID" is a field of type Text, we need extra quotes:
strWhere = "[ID] = """ & Me.txtFindID & """"
Apr 4 '07 #1
3 11916
Please help.
Apr 5 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
We can have an unbound text box on the form in which the person can type in the text box they want to go to retrieve information without having to use the find record button or menu option. For this we can use the After Update event to move to the desired record (please see below code). How can we hide or restrict other records to display in a columnar form as by default it shows entire record one by one? Please help or provide any alternate solution. Thank you.

This example assumes an unbound text box named "txtFindID" where the user enters the number to find:

Private Sub txtFindID_AfterUpdate()
Dim strWhere as String
If Not IsNull(Me.txtFindID) Then
If Me.Dirty Then 'Save first.
Me.Dirty = False
End If
strWhere = "[ID] = " & Me.txtFindID
With Me.RecordsetClone
.FindFirst strWhere
If .NoMatch Then
Msgbox "Not found."
Else
Me.Bookmark = .Bookmark
End If
End With
End If
End Sub

Note: If "ID" is a field of type Text, we need extra quotes:
strWhere = "[ID] = """ & Me.txtFindID & """"
Try something like
Expand|Select|Wrap|Line Numbers
  1. Me.Filter = strWhere
  2. Me.FilterOn = True
  3. Me.Requery
  4.  
Mary
Apr 6 '07 #3
Try something like
Expand|Select|Wrap|Line Numbers
  1. Me.Filter = strWhere
  2. Me.FilterOn = True
  3. Me.Requery
  4.  
Mary
Thanks for your response. Where to put this code? Secondly, what I should do with the form as it's based on a table and show all records. The code I had narrated is basically for navigation, within the form based on table. I want a text box to search and show specific record (only) in a table or query. Thank you.
Apr 6 '07 #4

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

Similar topics

7
by: Dave B | last post by:
Does anyone know of a program that will read a text file and fill in a web form with the contents of that file? We need to get about 3000 records (5 fields to each record) into a database owned by...
10
by: Paul Kooistra | last post by:
I need a tool to browse text files with a size of 10-20 Mb. These files have a fixed record length of 800 bytes (CR/LF), and containt records used to create printed pages by an external company. ...
22
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
2
by: allyn44 | last post by:
Hello, I have built a serch form for users to edit records. I only want them to pull up the record they need, and I want to check for nulls. There should not be dupes becasue the underlying...
1
by: =?Utf-8?B?UGF0cml4MzE3?= | last post by:
Caveat: newbie I would like to take the contents of the datagrid on my form and export it record by record to a flat text file. After some time searching, I came across two items: ...
4
by: pelicanstuff | last post by:
I found some code for text-searching in forms (using an unbound text box and a command button), and adapted it to look like this: Private Sub Command83_Click() Dim strPersonRef As String Dim...
13
by: Robertf987 | last post by:
Hi, Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000. What I want is to be able to do a...
2
by: Dave | last post by:
Access 2003 I have an unbound search form, which shows filtered search records in it’s sub-form. On the unbound search form I wish to place a button, which will close off the search form, and...
1
by: angelicdevil | last post by:
i have listbox 1 which displays status , based on selection of status listbox 2 displays usernames. and based on username selected the textbox displays the email id. its working fine till...
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
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
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
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
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...
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.