Selecting records based on multiple criteria for a report?

TBerg

New member
Local time
Today, 00:30
Joined
Apr 12, 2013
Messages
3
Hey all,

My first post today. I've often checked these boards for help in the past, but can't quite find the answer I'm looking for, for this particular issue.

So, here's what I'm trying to do. I'm working on a database as part of a research study, where we follow up with participants every few months. As part of this, we send different letters to them, depending on whether they prescheduled their next follow-up with us or not. I have working templates of these letters implemented into our access database already, and they work fine. But I've been trying to find ways to expedite some of the steps.

We recruit participants in waves, so we have them set up as "Groups" in the database. Group 1, group 2, etc. I'd like to make a button on the in the database and use VBA to ready reports for those that prescheduled, and those that didn't, by group.

Here is the code I have so far for those who have prescheduled their 12-month follow-up:

Private Sub Command1523_Click()
Dim strDocName As String
Dim strWhere As String
strDocName = "LTR - 12moReminder Pre"
strWhere = "[Group]=" & Me![Groups]
DoCmd.OpenReport strDocName, acPreview, , strWhere
End Sub

LTR - 12moReminder Pre = The Report template for 12 month reminder letters for those that prescheduled
[Group] = The field in the participant information table that indicates what group they are in
Me![Groups] = Refers to an unbound field on the forum, where the user can enter a number for the group that they want to pull

As it stands, this code works for what it is set up currently to do; pull up all records in a given group, based on what value the user puts in for Me![Groups]

But I don't know how to get it to filter down the results further, so that it is only returning those results who specifically prescheduled. We have a field to indicate if they prescheduled or not:

[12 Follow-Up Scheduled]

So I imagine I'm going to need to use something like

IsNull[12 Follow-Up Scheduled]=False, but I'm unsure of where I might incorporate this into the code. I've tried to add it into strWhere but I haven't been able to get the syntax right/I get other errors. Any thoughts?
 
Try this:

strWhere = "[Group]=" & Me![Groups] & " AND [12 Follow-Up Scheduled] = False"
 
Try this:

strWhere = "[Group]=" & Me![Groups] & " AND [12 Follow-Up Scheduled] = False"

That didn't exactly do as I needed it to do (since the 12 Follow-Up Scheduled variable is a date), but the format got me close enough that I was able to change a couple things and get it working! Thanks!
 

Users who are viewing this thread

Back
Top Bottom