Using Three Unbound Fields to Filter Form???

Help.Chris

Registered User.
Local time
Today, 14:10
Joined
Oct 11, 2000
Messages
43
I am trying to use three unbound fields to filter a form. I Have the fields in the form header, and the rest of the form is bound to the necessary fields. I can us bookmarks and Findfirst to search on one fields using the code below.

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone

rst.FindFirst "[Operator_Name] = " & adhHandleQuotes(Combo21, adhcQuote)
If rst.NoMatch Then
MsgBox "Operator Has No Campaigns Entered!"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
Set rst = Nothing

I have to use DAO as I am using an MDB file, the problem is that findfirst only searches by on fields, I need to search by three.

Please could someone assist me in implementing the additional code. My Access knowledge is good, but my VB knowledge isn't. So Code would be useful.

Thank for you help everyone
 
I also have had problems using the findfirst method. I compensated for it by specifying the criteria in an SQL string.

eg.

dim rs as dao.Recordset
dim db as dao.Database
dim strSQL as string

strSQl="SELECT * FROM Tablename WHERE Criteria;"
set db=currentDb
set rs=db.openrecordset(strSQL)

Hope this helps
Duane Barker
 
Thank you for any assistance provided

I have used the code posted, and I know the select statement is working(it didn't crash), but I need to then show the records of the form. Do I now use bookmarks?, (I did try the Me.Bookmark = rst.Bookmark command - didn't work). Any suggestions would be greatly appreciated.

Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim strSQL As String
strSQL = "SELECT Operator_Name FROM [Campaign Discounts Table] WHERE Operator_Name = " & Chr(34) & Combo21 & Chr(34) & ";"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)

Thanks,

Chris
 

Users who are viewing this thread

Back
Top Bottom