Public Function getExtendedList(ctl As Control, default As Variant, Optional delimiter As String = "") As Variant
Dim c As Variant
Dim res As Variant
For Each c In ctl.ItemsSelected
res = res & IIf(res = "", "", ",") & delimiter & ctl.ItemData(c) & delimiter
Next
If res = "" Then res = default
getExtendedList = res
End FunctionDamit kannst du z.B. einem Report ein SQL-Kriterium mitgeben, z.B. so mit PList als Multiselect-Liste):Private Sub btnReport_Click()
Dim s As String
s = getExtendedList(Me!PList, "", """")
If s <> "" Then
DoCmd.OpenReport "Projekt", acViewPreview, , "Projektname in (" & s & ")"
Else
MsgBox "Bitte zuerst ein oder mehrere Projekte auswählen"
End If
End Sub Private Sub mehrfachauswahlkombifeld_Change()
Dim c As Variant
Dim res As Variant
Dim ctl As Control
ctl = Me![mehrfachauswahlkombifeld]
For Each c In ctl.ItemsSelected
res = res & IIf(res = "", "", ",") & ctl.ItemData(c)
Next
' If res = "" Then res = default
Me![mehrfachauswahlkombifeld as String] = res
End Sub ctl = Me![mehrfachauswahlkombifeld].Private Sub mehrfachauswahlkombifeld_Change()
Dim c As Variant
Dim res As Variant
Dim ctl As Control
Set ctl = Me![mehrfachauswahlkombifeld]
For Each c In ctl.ItemsSelected
res = res & IIf(res = "", "", ",") & ctl.ItemData(c)
Next
' If res = "" Then res = default
Me![mehrfachauswahlkombifeld as String] = res
End Sub test = Me![Probe Type].ItemData(0)
WHERE (AllData.[Stadt]) In ([Formulare]![Search for something]![Textfeld Staedte as String]);
DoCmd.OpenQuery tb, acViewNormal, acReadOnly
counter = DCount("[ID]", tb)
DoCmd.Close acQuery, tb, acSaveNoMsgbox Dcount("*","Grundtabelle","Stadt in (" & Me![mehrfachauswahlkombifeld as String] & ")")
Kombinationsfeld Access2007
fpmarl 12.12.2008 - 34 Hits - 1 Antwort
Problem in Access - Kombinationsfeld führt Änderungen an DB durch
scochet 02.03.2009 - 676 Hits - 8 Antworten
Access: Abfrage nach Auswahl in Kombinationsfeld aktualisieren
Ruslan 29.06.2009 - 710 Hits - 7 Antworten
Daten aus Kombinationsfeld in Textfeld auslesen lassen
Evolut1on 10.09.2009 - 302 Hits - 1 Antwort