473,385 Members | 1,620 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,385 software developers and data experts.

Find Record using three Criteria

How can I use three criteria to find a record? I've done this before
where I only use one criteria to find a record and set the focus to
that criteria only.
Thanks in advance.

Nov 13 '05 #1
4 4389
kufre wrote:
How can I use three criteria to find a record? I've done this before
where I only use one criteria to find a record and set the focus to
that criteria only.


How are you searching? Using the Find function (Ctrl-F)? Using the
Filter option (right-click menu on forms/datasheets)? In a query?
Using the recordset .Find?

......? More info please.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Nov 13 '05 #2
"kufre" wrote
How can I use three criteria to
find a record? I've done this before
where I only use one criteria to find
a record and set the focus to
that criteria only.

In what context? You can certainly use multiple criteria in a Query, but
there are some limitations in the D... functions. However, you can base a
DLookup, say, on a Query that has criteria of its own to circumvent the
limitations. The manual Find and Filter operations may be more
problematical.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #3
I have a Find command button on my form that I would like to use to
perform my search.

Nov 13 '05 #4
kufre wrote:
I have a Find command button on my form that I would like to use to
perform my search.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Usually, you can do something like this:

Private Sub cmdFind_Click()

Dim strCriteria As String
Dim rs As DAO.Recordset

' Set the criteria to values in different TextBoxes.
strCriteria = "col1 = " & Me!txtANumber
strCriteria = strCriteria & " AND col2 = '" & Me!txtAString & "'"
strCriteria = strCriteria & " AND col3 = #" & Me!txtADate & "#"

' Get the same Recordset as the form
Set rs = Me.RecordsetClone

' Try to find the data w/ the criteria
rs.FindFirst strCriteria

If Not rs.NoMatch Then
' Do something w/ the found data
MsgBox "Found"
Else
MsgBox "Not Found"
End If

' Clean up & exit
Set rs = Nothing

End Sub

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQji294echKqOuFEgEQKDXwCfaeAHk1C/NyqM+fkfwim/EDglcqAAnicz
LNoKy8EPJD31+LQ41Oc5xmg9
=TnnT
-----END PGP SIGNATURE-----
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: PC | last post by:
Hi, I have used the DLast("!","")function to find and display the last entry in a table. How would I go about displaying the last record in a table that is not Null? Thanks in advance ...pc
3
by: Tom Mitchell | last post by:
All: I'm stumped on a query. How do I find duplicates in a table where one of the duplicates has values is a certain field and the other doesn't. For example, I have the following table: ...
3
by: Bob C. | last post by:
When I migrated my tables to SQL Server I needed a way to overcome the slow performance of the Find method on my recordsets. Although this can be done by accessing the table directly using dao and...
3
by: Bob Hynes | last post by:
Hi All, In Access97 I have a linked table(jet backend on a server) which contains 217,432 records today, I have a form on which users enter a policy number which they want to find and have...
2
by: Lyn | last post by:
If I have a form where the RecordSource property is set to the name of a table, then on opening the SingleForm form I can cycle through all the records in the table one at a time via Next and...
8
by: jquest | last post by:
Hi Again; I have had help from this group before and want to thank everyone, especially PCDatasheet. My database includes a field called HomePhone, it uses the (xxx)xxx-xxx format to include...
0
by: 2D Rick | last post by:
I input data into two textboxes on Form1 which returns three records into Form2. I then Print record 2of3 using criteria from Form2. stLinkCriteria = "= '" & Forms!! & "'" & " AND = '" &...
1
by: emmaruwa | last post by:
I have a form with two text boxes (in its details section) that pull data from two fields in my database table. This same form also has a button beside the text boxes which is supposed to open...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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,...

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.