הקוד מצ"ב
Private Sub IDtext_LostFocus() Dim TempTxt As String 'שליפת רשומה מבסיס הנתונים 'לפי ת.ז 'שליפת רשומה מבסיס הנתונים 'לפי שם פרטי 'SELECT tblClients.LoanerId, tblClients.Pname, tblClients.Fname, tblClients.Street, tblClients.Num, tblClients.Shchuna, tblClients.Yeshuv, tblClients.ZipCode, tblClients.Phone, tblClients.Cellolar, tblClients.WorkPhone, tblClients.Remarks, tblClientType.Descrirtion FROM tblClients LEFT JOIN tblClientType ON tblClients.ClientType = tblClientType.ClientType Where (((tblClients.Pname) = "אבינועם")) ORDER BY tblClients.Fname; 'שליפת רשומה מבסיס הנתונים 'לפי שם משפחה 'SELECT tblClients.LoanerId, tblClients.Pname, tblClients.Fname, tblClients.Street, tblClients.Num, tblClients.Shchuna, tblClients.Yeshuv, tblClients.ZipCode, tblClients.Phone, tblClients.Cellolar, tblClients.WorkPhone, tblClients.Remarks, tblClientType.Descrirtion FROM tblClients LEFT JOIN tblClientType ON tblClients.ClientType = tblClientType.ClientType Where (((tblClients.Fname) = "כהן")) ORDER BY tblClients.Pname; TempTxt = Format(IdText.Text, "000000000") If IdText.Text <> "" Then If ChkID(TempTxt) = True Then ' MsgBox "תעודת זהות תקינה" AdoLoaners.RecordSource = "SELECT tblClients.LoanerId, tblClients.Pname, tblClients.Fname, tblClients.Street, tblClients.Num, tblClients.Shchuna, tblClients.Yeshuv, tblClients.ZipCode, tblClients.Phone, tblClients.Cellolar, tblClients.WorkPhone, tblClients.ClientType, tblClients.Remarks FROM tblClients LEFT JOIN tblClientType ON tblClients.ClientType = tblClientType.ClientType WHERE (((tblClients.LoanerId)=" & TempTxt & "));" AdoLoaners.Refresh 'כאן השגיאה If AdoLoaners.Recordset.RecordCount = 1 Then IdText.Text = AdoLoaners.Recordset.Fields(0) txtPname.Text = AdoLoaners.Recordset.Fields(1) txtFname.Text = AdoLoaners.Recordset.Fields(2) txtStreet.Text = AdoLoaners.Recordset.Fields(3) txtNum.Text = AdoLoaners.Recordset.Fields(4) txtCity.Text = AdoLoaners.Recordset.Fields(6) txtZipCode.Text = AdoLoaners.Recordset.Fields(7) txtPhone.Text = AdoLoaners.Recordset.Fields(8) txtCell.Text = AdoLoaners.Recordset.Fields(9) txtWork.Text = AdoLoaners.Recordset.Fields(10) txtRemarks.Text = AdoLoaners.Recordset.Fields(11) Else MsgBox "מספר ת.ז לא תקין" IdText.Text = "" IdText.SetFocus SendKeys ("{home}+{end}") End If End If End If End Sub