setfocus
18.02.2003 12:41:26
mbek
ich habe folgendes Problem und zwar:
sub test()
If txtPSNr.Text = "" Or IsEmpty(txtPSNr.Text) Or IsNull(txtPSNr.Text) Then
Exit Sub
Else
sqltext = "SELECT count(*) from tbl_ps where ps_nr = " & txtPSNr.Text & " and ps_aktiv = 1;"
Set rs = db.OpenRecordset(sqltext)
If rs.Fields(0).Value = 1 Then
rs.Close
sqltext = "Select ps_name, ps_vorname from tbl_ps where ps_nr = " & txtPSNr.Text & ";"
Set rs = db.OpenRecordset(sqltext)
lblNachname.Caption = rs.Fields(0).Value
lblVorname.Caption = rs.Fields(1).Value
rs.Close
Else
MsgBox "Personal.- Nr. " & txtPSNr.Text & " ist entweder nicht vorhanden " & vbCrLf & _
"oder nicht mehr aktiv !", 16 + 0, "Fehler"
txtPSNr.setfocus
End If
End If
end sub
Das Problem:
Der Cursor springt gleich nachdem MsgBox (Fehlermeldung) auf nächste Textfeld. Wie kann ich den Cursor steuern, damit der Cursor wieder auf den ursprunglichen Textfeld (txtPSNr) steht ?.
PS: mit txtpsnr.setfocus habe ich ausprobiert, klappt aber nicht.
kann jemand mir bitte helfen ?
danke
gruß
mbek