borg » 23.03.2005 (Ср) 17:22
Dim strquery As String
Dim db As New ADODB.Connection
Dim rc As New ADODB.Recordset
Dim query As String
Set db = CurrentProject.Connection
On Error GoTo ErrorHandler
Dim Fam As String
Dim nam As String
Dim ot4 As String
Dim nom_ud As String, podr As String, prik As String, spec As String
Dim yeard As String
Dim flag As Boolean, df As Boolean
Forms![LS_find_form]!Fam_field.SetFocus
Fam = Forms![LS_find_form]!Fam_field.Text
Forms![LS_find_form]!Nam_field.SetFocus
nam = Forms![LS_find_form]!Nam_field.Text
Forms![LS_find_form]!Ot4_field.SetFocus
ot4 = Forms![LS_find_form]!Ot4_field.Text
Forms![LS_find_form]!nomud.SetFocus
nom_ud = Forms![LS_find_form]!nomud.Text
Forms![LS_find_form]!podr.SetFocus
podr = Forms![LS_find_form]!podr.Text
Forms![LS_find_form]!yeard.SetFocus
yeard = CVar(Forms![LS_find_form]!yeard.Text)
Forms![LS_find_form]!prik.SetFocus
prik = Forms![LS_find_form]!prik.Text
Forms![LS_find_form]!spec.SetFocus
spec = Forms![LS_find_form]!spec.Text
query = "select * from lichn_sost"
flag = False
df = False
Call addquery(df, flag, query, "Familia", Fam)
Call addquery(df, flag, query, "Imya", nam)
Call addquery(df, flag, query, "Otchestvo", ot4)
Call addquery(df, flag, query, "Nom_Ud_Lichn", nom_ud)
Call addquery(df, flag, query, "Id_sho", podr)
df = False
Call addquery(df, flag, query, "year_rojd", yeard)
Call addquery(df, flag, query, "Nom_prikaza", prik)
Call addquery(df, flag, query, "Specialnosti", spec)
DoCmd.OpenForm "find_rez_LS"
rc.CursorLocation = adUseClient
rc.Open query, db, adOpenDynamic, adLockReadOnly
If rc.AbsolutePosition Then
rc.MoveFirst
End If
If rc.RecordCount = 0 Then
MsgBox "Записей, удовлетворяющих критериям поиска не обнаружено", vbOKOnly
Exit Sub
Else
DoCmd.OpenForm "Find_rez_LS"
Set Forms!find_rez_LS!DataGrid.DataSource = rc
End If
Exit Sub
ErrorHandler:
Select Case Err.Number
Case 2501
Resume Next
Case Else: MsgBox "ошибка " & Err.Description, vbOKOnly
End Select
после выполнения всей этой бодяги
datagrid остается пустой
в чем дело?
хотя записи удовлетворяющие запросу были найдены