Ich habe ein Hauptformular die als Datenquelle eine Tabelle vom SQL Server hat. Im Detailbereich habe ich lauter Textboxen die als Steuerelementeinheit Spalten der Tabelle haben(ID, Name und sowas).
Ich will für den Anfang nur ein Suchhfeld und einen Button haben mit dem man die ID suchen kann und die anderen Felder zu der ID angezeigt werden.
Ach ja, hier benutze ich eine zweite Form für die Suche, mir wäre es aber ersteinmal lieber, wenn das auf einer Form funktioniert.
Ich will für den Anfang nur ein Suchhfeld und einen Button haben mit dem man die ID suchen kann und die anderen Felder zu der ID angezeigt werden.
Visual Basic-Quellcode
- Dim strSQL As String
- If Not IsNull(txtID) Then
- strSQL = "select dbo_T_Adresse " & _
- "from dbo_T_Adresse As T1 " & _
- " WHERE T1.dbo_T_Adresse.ID = '" & Me.txtID & "' "
- Forms!FRM_ADRESSE_HPTFRM.filter = strSQL
- Forms!FRM_ADRESSE_HPTFRM.FilterOn = True
- DoCmd.Close acForm, "FRM_Schnellsuche"
- Else: DoCmd.Close acForm, "FRM_Schnellsuche" 'Bei Suche nach nichts wird abgebrochen
- End If
Ach ja, hier benutze ich eine zweite Form für die Suche, mir wäre es aber ersteinmal lieber, wenn das auf einer Form funktioniert.