Option
Compare Database
Option
Explicit
Sub
Demo()
Dim
mbxResult
As
VbMsgBoxResult
Dim
strInput
As
String
Dim
strCriteria
As
String
Dim
lngNumRecords
As
Long
Const
SQL_LIKE
As
String
=
"[Bemerkung] alike '%{0}%'"
Do
lngNumRecords = -1
strInput = InputBox( _
Prompt:=
"Geben Sie einen Suchbegriff ein."
, _
Title:=
"Suche mit Joker"
_
)
If
StrPtr(strInput) > 0
Then
strCriteria = Replace(SQL_LIKE,
"{0}"
,
CStr
(strInput))
lngNumRecords = DCount(
"*"
,
"tblMieter"
, strCriteria)
If
lngNumRecords = 0
Then
mbxResult = MsgBox( _
Prompt:=
"Ihr Suchkriterium wurde nicht gefunden"
, _
Buttons:=vbRetryCancel + vbDefaultButton2 _
)
End
If
End
If
Loop
Until
mbxResult = vbCancel
Or
lngNumRecords <> 0
If
lngNumRecords > 0
Then
End
If
End
Sub