Hi
Well, i think i have been fiddling with the code too much cause now it doesnt work at all. The annoying thing is i kept a copy of it before i started to change it but even if i put it back to the original it still wont work
I am not getting any error messages at all now, but clickling the OK button does nothing.
This is what i have now behind the OK button
Private Sub OK_Click()
Dim RepTo As String
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim str As String
Set frm = Form!frmReport
RepTo = "rptProduction"
str = "[country] in ("
Set ctl = frm.boxCountry
If ctl.ItemsSelected.Count = 0 Then
DoCmd.OpenReport RepTo, acViewPreview
Else
For Each varItem In ctl.ItemsSelected
str = str & ctl.ItemData(varItem) & ", "
Next varItem
str = Left$(str, Len(str) - 2)
str = str & "

"
DoCmd.OpenReport RepTo, acViewPreview, , str
End If
End Sub
And this is what is in the query
I took out all the
Like "*" & [Forms]![frmreport]![boxCountry] & "*" Or nz([Forms]![frmreport]![boxCountry],""=""
criteras i had in their previously casue i thought it might help, but it didnt.
SELECT [tblproduction forecast].Country, [tblproduction forecast].TYPE, [tblproduction forecast].MFR, [tblproduction forecast].SEG, [tblproduction forecast].PLATF, [tblproduction forecast].MODEL, [tblproduction forecast].[2003], [tblproduction forecast].[2004], [tblproduction forecast].[2005], [tblproduction forecast].[2006], [tblproduction forecast].[2007], [tblproduction forecast].[2008], [tblproduction forecast].[2013], [tblproduction forecast].GROUP, [tblproduction forecast].ASS, [tblproduction forecast].[ASS/ PROD]
FROM [tblproduction forecast]
ORDER BY [tblproduction forecast].Country, [tblproduction forecast].TYPE, [tblproduction forecast].MFR, [tblproduction forecast].MODEL;
A bit more background, it is a database with production forecast figures for cars produced in asia (and will have sales figures if i can get this part working first)
I need to be able to generate report by country, manufacturer etc, and sometimes by more than one i.e. japan and china, and sometimes all of asia.
what did i do wrong???
It will still work if i go back and do it the old way with the "like" criterias in the query but then i can only select one item from the boxes, and it will only open if the report is opened first. If i cant select more than one it is not going to be worth it.
Thanks in advance
......Carly