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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get rid of the PopUp window after selecting from the ListBox?

Status
Not open for further replies.

mooneater

Programmer
Jul 2, 2003
7
0
0
DE
Hello!

I have a ListBox with the name IstCountry were several Countries are in which one can choose (0 to all).
And I got a Button with a code behind, as follows...

'-------------------------------------------------------------------
Private Sub Command57_Click()

Dim Element As Variant
Dim Bedingung As String
Dim Country As Variant

'Ist überhaupt ein Eintrag markiert?
If Me!IstCountry.ItemsSelected.Count = 0 Then Exit Sub
'Bedingung zusammenstellen
For Each Element In Me!IstCountry.ItemsSelected
Country = Me!IstCountry.ItemData(Element)
Bedingung = Bedingung & "Country = " & Country & " OR "
Next Element

'Rechtes OR abschneiden
Bedingung = Left(Bedingung, Len(Bedingung) - 4)
DoCmd.OpenReport ReportName:="Abfrage_issued_cheques_report_o_amount1", WhereCondition:=Bedingung, View:=acPreview
End Sub
'-------------------------------------------------------------------

It all works pretty well .. BUT .. there is a PopUp Window after selecting a country that says "Enter parameter value" then there is the country as I marked it as header and a textfield below wher i have to type that selected country in again to get the report just for that certain contry.

...What do I do wrong?

I want to get rid of that PopUp-Window of course, cause I thought all is properly selected, but as it seems, it is not.

Any idea appreciated
Greetings
..Nils
 
Hi Nils,

I think your problem, as so often, is to do with quotes. You build a string like Country = Engeland OR Country = Deutschland and Access thinks the country names are variables which it can't resolve. To make the country names into strings and the condition into Country = "Engeland" OR Country = "Deutschland" you need ...

Code:
Bedingung = Bedingung & "Country =
Code:
""
Code:
" & Country & "
Code:
""
Code:
 OR "

Enjoy,
Tony
 
Cool! .. Thanks a lot!!!

First i wondered if that will ever work .. but .. thanks to you master of quotationmrks it works peeeeerfectly!

Oh thank god there are newsgroups .. and clever people like you! :)

Best greetings,
Nils
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top