I have a similar problem and I have been following the advice but to no avail. I am a novice with VBA so help would be greatly appreciated. This is my first post so I apologise if it is in the wrong place or format.
In my query I have:
and in the form I have:
Case 1 is fine. The problem is with Case 2. I am trying to select multiple values from a list box to use for the parameter mentioned above in the query to produce a report. However I keep getting the report with errors (meaning that the invigilator has not been found). (The cases are there because radio buttons are used to produce either one report or the other - I have had it working before with just single values).
In my query I have:
Code:
Field: Invigilator no Table: VerifiedPayments Criteria: [Forms]![SelectWeek]![List0]
Code:
Dim stDocName As String Dim varX As Variant Dim strWhere As String Select Case Me!optOpenReport Case 1 stDocName = "InvigilatorClaims" DoCmd.OpenReport stDocName, acPreview Case 2 stDocName = "InvigilatorClaimsIndividual" With Me.List0 For Each varX In .ItemsSelected strWhere = strWhere & "," & .ItemData(varX) Next varX strWhere = "[Invigilator no] In(" & Mid(strWhere, 2) & ")" Call DoCmd.OpenReport(ReportName:=stDocName, _ View:=acPreview, _ WhereCondition:=strWhere) End With End Select
Comment