strsql = "EXEC dbo.spAlfSuchabfrage " & Nz(DateTimeForSQL(Me.SuchDatum)) & ", " & Nz(Me.SuchLfNr, Null) & ", " & Nz(Me.SuchVAnr, Null) & ", " & Nz(Me.SuchProID, Null) & ", " & Nz(Me.SuchAlarmart, Null) & ", " & Nz(Me.Suchkennummer, Null)
[COLOR=blue][FONT=Consolas]but...[/FONT][/COLOR]
[FONT=Consolas][COLOR=#0000ff][/COLOR][/FONT]
[FONT=Consolas][COLOR=#0000ff]...[/COLOR][/FONT]
[COLOR=blue][FONT=Consolas]WHERE [/FONT][/COLOR][COLOR=gray][FONT=Consolas]([/FONT][/COLOR][COLOR=teal][FONT=Consolas]LeistungsDatum[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchDatum[/FONT][/COLOR][COLOR=gray][FONT=Consolas]OR[/FONT][/COLOR][COLOR=blue][FONT=Consolas]casewhen[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchDatum[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=black][FONT=Consolas]0 [/FONT][/COLOR][COLOR=blue][FONT=Consolas]then[/FONT][/COLOR][COLOR=gray][FONT=Consolas]Null[/FONT][/COLOR][COLOR=blue][FONT=Consolas]end[/FONT][/COLOR][COLOR=gray][FONT=Consolas]ISNULL)AND[/FONT][/COLOR]
[COLOR=gray][FONT=Consolas]([/FONT][/COLOR][COLOR=teal][FONT=Consolas]LfNummer[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchLfNr[/FONT][/COLOR][COLOR=gray][FONT=Consolas]OR[/FONT][/COLOR][COLOR=blue][FONT=Consolas]casewhen[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchLfNr[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=black][FONT=Consolas]0 [/FONT][/COLOR][COLOR=blue][FONT=Consolas]then[/FONT][/COLOR][COLOR=gray][FONT=Consolas]Null[/FONT][/COLOR][COLOR=blue][FONT=Consolas]end[/FONT][/COLOR][COLOR=gray][FONT=Consolas]ISNULL)AND[/FONT][/COLOR]
[COLOR=gray][FONT=Consolas]([/FONT][/COLOR][COLOR=teal][FONT=Consolas]Veranstaltung[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchVAnr[/FONT][/COLOR][COLOR=gray][FONT=Consolas]OR[/FONT][/COLOR][COLOR=blue][FONT=Consolas]casewhen[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchVAnr[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=black][FONT=Consolas]0 [/FONT][/COLOR][COLOR=blue][FONT=Consolas]then[/FONT][/COLOR][COLOR=gray][FONT=Consolas]Null[/FONT][/COLOR][COLOR=blue][FONT=Consolas]end[/FONT][/COLOR][COLOR=gray][FONT=Consolas]ISNULL)AND[/FONT][/COLOR]
[COLOR=gray][FONT=Consolas]([/FONT][/COLOR][COLOR=teal][FONT=Consolas]PrOID[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchProID[/FONT][/COLOR][COLOR=gray][FONT=Consolas]OR[/FONT][/COLOR][COLOR=blue][FONT=Consolas]casewhen[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchProID[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=black][FONT=Consolas]0 [/FONT][/COLOR][COLOR=blue][FONT=Consolas]then[/FONT][/COLOR][COLOR=gray][FONT=Consolas]Null[/FONT][/COLOR][COLOR=blue][FONT=Consolas]end[/FONT][/COLOR][COLOR=gray][FONT=Consolas]ISNULL)AND[/FONT][/COLOR]
[COLOR=gray][FONT=Consolas]([/FONT][/COLOR][COLOR=teal][FONT=Consolas]SdlID[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchSuchAlarmart[/FONT][/COLOR][COLOR=gray][FONT=Consolas]OR[/FONT][/COLOR][COLOR=blue][FONT=Consolas]casewhen[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchSuchAlarmart[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=black][FONT=Consolas]0 [/FONT][/COLOR][COLOR=blue][FONT=Consolas]then[/FONT][/COLOR][COLOR=gray][FONT=Consolas]Null[/FONT][/COLOR][COLOR=blue][FONT=Consolas]end[/FONT][/COLOR][COLOR=gray][FONT=Consolas]ISNULL)AND[/FONT][/COLOR]
[COLOR=gray][FONT=Consolas]([/FONT][/COLOR][COLOR=teal][FONT=Consolas]tblLeistungen[/FONT][/COLOR][COLOR=gray][FONT=Consolas].[/FONT][/COLOR][COLOR=teal][FONT=Consolas]Kennummer[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@Suchkennummer[/FONT][/COLOR][COLOR=gray][FONT=Consolas]OR[/FONT][/COLOR][COLOR=blue][FONT=Consolas]casewhen[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@Suchkennummer[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=black][FONT=Consolas]0 [/FONT][/COLOR][COLOR=blue][FONT=Consolas]then[/FONT][/COLOR][COLOR=gray][FONT=Consolas]Null[/FONT][/COLOR][COLOR=blue][FONT=Consolas]end[/FONT][/COLOR][COLOR=gray][FONT=Consolas]ISNULL)[/FONT][/COLOR]
[COLOR=gray][FONT=Consolas][/FONT][/COLOR]
[COLOR=gray][FONT=Consolas]gives an error[/FONT][/COLOR]
[FONT=Consolas][COLOR=#808080][/COLOR][/FONT]
[COLOR=gray][FONT=Consolas]and[/FONT][/COLOR]
[COLOR=blue][FONT=Consolas]....WHERE [/FONT][/COLOR][COLOR=gray][FONT=Consolas]([/FONT][/COLOR][COLOR=teal][FONT=Consolas]LeistungsDatum[/FONT][/COLOR][COLOR=gray][FONT=Consolas]=[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchDatum[/FONT][/COLOR][COLOR=gray][FONT=Consolas]OR[/FONT][/COLOR][COLOR=teal][FONT=Consolas]@SuchDatum[/FONT][/COLOR][COLOR=gray][FONT=Consolas]ISNULL)AND ....[/FONT][/COLOR]
[COLOR=gray][FONT=Consolas][/FONT][/COLOR]
[COLOR=gray][FONT=Consolas]gives an error too, as I send this to the server through the PT-query:[/FONT][/COLOR]
[COLOR=blue][FONT=Consolas][/FONT][/COLOR]
[COLOR=blue][FONT=Consolas]EXEC[/FONT][/COLOR][COLOR=teal][FONT=Consolas]dbo[/FONT][/COLOR][COLOR=gray][FONT=Consolas].[/FONT][/COLOR][COLOR=teal][FONT=Consolas]spAlfSuchabfrage[/FONT][/COLOR][COLOR=red][FONT=Consolas]'2014-12-02 0:00:00'[/FONT][/COLOR][COLOR=gray][FONT=Consolas],,,,,[/FONT][/COLOR]
but dbo.spAlfSuchabfrage failed as the parameters might be empty and I can't define the script.
[FONT=Consolas][SIZE=2][COLOR=#808080][FONT=Consolas][SIZE=2][COLOR=#808080][SIZE=2][FONT=Consolas][COLOR=#808080][FONT=Consolas][SIZE=2][COLOR=#808080]
[SIZE=2][FONT=Consolas][COLOR=#808080][SIZE=2][FONT=Consolas][COLOR=#808080][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2][COLOR=#000000]So I am very interested in your proposal to solve this problem.[/COLOR][/SIZE][/FONT][/SIZE][/FONT]
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2][COLOR=#000000]I need it for a "search-Form"[/COLOR][/SIZE][/FONT][/SIZE][/FONT]
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2][COLOR=#000000]Thanks[/COLOR][/SIZE][/FONT][/SIZE][/FONT]
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2][COLOR=#000000]Michael[/COLOR][/SIZE][/FONT]
[/SIZE][/FONT][/COLOR][/FONT][/SIZE][/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/FONT][/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]