Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter Records using RecordsetClone 1

Status
Not open for further replies.

Accel45

Technical User
Jul 7, 2004
83
US
I am using the following code to move the records from a continuous form to a text field. This code returns all of the records in the form. I want the code to return only the records that meet a certain criteria, ie. (The print check box in the record is checked)

What changes to the code do I make to accomplish this?

Thanks
accel45

Public Sub PackEEG()
Dim rst As DAO.Recordset, Pack As String, DL As String

Set rst = Me.RecordsetClone
rst.MoveFirst
DL = vbNewLine
'& vbNewLine

Do
Pack = Pack & Format(rst!Date, "ddd") & ", " & Format(rst!Date, "mmm dd"", ""yyyy") & vbCrLf
Pack = Pack & Format(rst!Event, ">") & " "
Pack = Pack & Format(rst!Time, "h:mmAM/PM") & " "
Pack = Pack & rst!Opponent & " @" & " "
Pack = Pack & rst!Location & vbCrLf
Pack = Pack & rst!Note & vbCrLf

rst.MoveNext

If Not rst.EOF Then Pack = Pack & DL
Loop Until rst.EOF

Me!YourMemoControlName = Pack
DoCmd.RunCommand acCmdSaveRecord
Set rst = Nothing
End Sub
 
Something like this ?
...
Do
If rst![name of print check box field] = True
Pack = Pack & ...
...
End If
rst.MoveNext
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top