Hallo
Könnte mir bitte jemand bei meinem Code helfen. Ich habe eine Abfrage und die liefert mehrere Ergebnisse je nach [Position]. In der Tabelle habe ich auch noch ein Datumsfeld. Wie muss ich den SQL Code ändern damit er mir nur noch den Datensatz mit dem max Datum anzeigt.
FG Martin
Dim db As DAO.Database
Dim rst2 As DAO.Recordset2
Dim strSQL As String
Dim var
Set db = CurrentDb '
strSQL = "Select * from Upro_Spaltenverlauf_von_Beschreibung where Position = '" & Nz(Me!Position, "") & "'"
Set rst2 = db.OpenRecordset(strSQL)
If Not rst2.EOF Then rst2.MoveFirst
Do While Not rst2.EOF
Debug.Print var
rst2.MoveNext
Loop
rst2.Close
Set rst2 = Nothing
Set db = Nothing
|