By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,856 Members | 2,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,856 IT Pros & Developers. It's quick & easy.

Find Record using three Criteria

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
"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

P: n/a
I have a Find command button on my form that I would like to use to
perform my search.

Nov 13 '05 #4

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.