G

#### Guest

This code is from a command button on a form. The user has 3 list boxes to

choose form. My results reflect two of the choices. COuld you please help

me add the third.

Toward the bottom is where I'm struggling: stLinkCriteria = "[gbulocation] "

& stAreaList & " and [insurancetype] " & stProductList

When I try to add [Reviewer] " & stReviewerList - I get a Compile Error:

Expected: end of statement.......

Please help I'm so close.....

Dim stDocName As String

Dim X As Integer

Dim Y As Integer

Dim Z As Integer

Dim stArea As Variant

Dim stProduct As Variant

Dim stReviewer As Variant

stDocName = "Report1"

stAreaList = ""

stProductList = ""

stReviewerList = ""

If IsNull(txtStart) Or IsNull(txtEnd) Then

MsgBox "Please enter start and end dates"

Exit Sub

Else

X = 0

For Each stArea In ListArea.ItemsSelected

If X = 0 Then

stAreaList = "In('" & ListArea.ItemData(stArea) & "'"

Else

stAreaList = stAreaList & ",'" & ListArea.ItemData(stArea) &

"'"

End If

X = X + 1

Next stArea

If X > 0 Then stAreaList = stAreaList & ")"

Y = 0

For Each stProduct In ListProduct.ItemsSelected

If Y = 0 Then

stProductList = "In('" & ListProduct.ItemData(stProduct) & "'"

Else

stProductList = stProductList & ",'" &

ListProduct.ItemData(stProduct) & "'"

End If

Y = Y + 1

Next stProduct

If Y > 0 Then stProductList = stProductList & ")"

Z = 0

For Each stReviewer In ListReviewer.ItemsSelected

If Z = 0 Then

stReviewerList = "In('" & ListReviewer.ItemData(stReviewer)

& "'"

Else

stReviewerList = stReviewerList & ",'" &

ListReviewer.ItemData(stReviewer) & "'"

End If

Z = Z + 1

Next stReviewer

If Z > 0 Then stReviewerList = stReviewerList & ")"

If stAreaList <> ")" And stProductList <> ")" And stReviewerList <>

")" Then

stLinkCriteria = "[gbulocation] " & stAreaList & " and

[insurancetype] " & stProductList

ElseIf stAreaList = ")" And stProductList <> ")" Then

stLinkCriteria = "[insurancetype] " & stProductList

ElseIf stAreaList <> ")" And stProductList = ")" Then

stLinkCriteria = "[gbulocation] " & stAreaList

End If

DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

End If