473,466 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Find records within a data access page

1 New Member
I am using access 2000 and have a DAP that I created from a table. What I am trying to do is essentially create a find command that will search all records in the DAP based on user input. I have tried a few things but nothing will work, this is one vbscript I have tried.

Expand|Select|Wrap|Line Numbers
  1. '-----------------------------------------------------------------------
  2. 'This routine searches all fields in the defaultrecordset for something
  3. 'entered by a user in a Search text box. It passes through each field
  4. 'the recordset until it finds a match.
  5. '-----------------------------------------------------------------------
  6. dim i           'Counter variable
  7. dim rs          'ADO recordset object
  8. dim fld         'ADO field object
  9. dim FieldCount  'Number of fields in the recordset
  10.  
  11. FieldCount = MSODSC.DefaultRecordset.Fields.Count
  12.  
  13. 'This will return the default recordset on the page
  14. 'in this case, the Customers table.
  15. set rs = MSODSC.DefaultRecordset
  16.  
  17. for i = 0 to FieldCount - 1
  18.     'get a field object
  19.     set fld = rs.Fields(i)
  20.  
  21.     '0 = Skip no records
  22.     '1 = Search forward
  23.     '1 = Start with the first record
  24.     rs.Find fld.name & " = '" & txtSearch.value & "'", 0, 1, 1
  25.  
  26.     'Check for EOF.  If  at EOF but have not exhausted
  27.     'all the fields, then reset to the first position in the 
  28.     'recordset.  Otherwise, if a match was found, exit the loop.
  29.     if rs.EOF then 
  30.         rs.MoveFirst
  31.     else
  32.         exit for
  33.     end if
  34. next
  35.  
  36. 'Clean up.
  37. set fld = nothing
  38. set rs = nothing

Please help if you can!! Thanks.
Apr 25 '07 #1
1 1537
kcddoorman
76 New Member
I got this to work for searching integers in a field.

I'm having a problem getting the string search to work though.

http://www.thescripts.com/forum/showthread.php?p=2835830#post2835830
Sep 26 '07 #2

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

Similar topics

8
by: tom | last post by:
I am new to SQL administration. >From a list of IDs that are the primary key in one table (i.e. Customer Table), I want to make changes in tables that use those IDs as a foreign key. ...
5
by: Grant | last post by:
Hi Is there a way to recover deleted records from a table. A mass deletion has occurred and Access has been closed since it happened Louis
6
by: Damon Grieves | last post by:
Hi I just want to be sure I understand how the Access client works. If I have an Access back end with a million records on a server and an Access client. If the client is installed on the users pc...
1
by: VMI | last post by:
I need to display Access data in a datagrid but the Access table has over 2 million records. Since I can't fill a datatable with all those records but the user needs to see all of them, how can I...
3
by: POL8985 | last post by:
The application is developed in ASP.Net with a SQL Server database. Essentially, the application uses a single shared Connection object for all users logged into the system. The connection...
2
by: Birderman | last post by:
Hi, Using MS ACCESS 2003, i have a form for entering data. wih one object on the form (yes/no field) I want to inititiate vba code to run if it changes. I have no problem gettting it to update...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
1
by: marcnz | last post by:
I have been charged of creating a coldfusion web site for our company. Our database has a ms sql 2005 backend and ms access frontend. Almost all tables are linked tables with the SQL database,...
0
by: ramyareddy | last post by:
Hi All, i am using mssql 2005 and i am facing a strange problem. i have two databases A , B.When i try to insert one row in A from my application it is inserting the row but after that it is...
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
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.