private void btnNext_Click(object sender, EventArgs e) { if (KeyField != "" && KeyControl != null && TableName != "") { if (KeyControl.IsNotEmpty()) { ArsSQLQry qryForm = new ArsSQLQry(); qryForm.artezQry = isArtezDB; qryForm.SQLText = "SELECT TOP 1 " + KeyField + " FROM [" + TableName + "] " + "WHERE /*WS*/REC_ID > (SELECT REC_ID FROM " + TableName + " WHERE " + KeyField + " = '" + KeyControl.GetDataStr() + "')/*WE*/ " + "ORDER BY REC_ID"; qryForm.Open(); if (qryForm.Found()) { keyControl.Focus(); keyControl.SetDataStr(qryForm.GetString(KeyField)); tbFocusForm.Focus(); } } else { btnFirst_Click(btnFirst, null); } } }