Russian version
English version
| | | | SILICON TAIGA | ISDEF | CD | | | | | | | |
 

 
 
IT-
 
 
 
RSS-

DLookUp , , , . . MSA .

. , . DLookUp, , . , DLookup, . DLookup , , (. http://msa.dimsign.ru/index.php?type=112&idTheme=114).

Public Function GetRec(NameOfField As String, NameOfTable As String, Optional Where As String = "")
Dim r As Recordset
Dim sql As String
Dim result
On Error GoTo 2

sql = "SELECT " & NameOfField & " FROM " & NameOfTable
If Len(Where) > 0 Then sql = sql & " WHERE (" & Where & ")"
Set r = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
If r.EOF And r.BOF Then GoTo 1
r.MoveFirst
result = r.Fields(NameOfField)
1:

r.Close
Set r = Nothing
GetRec = result
Exit Function
2:
'MsgBox " : " & sql & "!"
GetRec = "None" ' Null
End Function

. - , - . , . .

Public Function Delrec(Tbl As String, Whr As Long, Optional OneRec As Long = 0) As Boolean
Dim r As Recordset
Dim sql As String
sql = "SELECT * FROM " & Tbl & " WHERE " & Whr
Set r = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
If r.EOF And r.BOF Then Delrec = False: GoTo 1
r.MoveLast
If r.RecordCount > 1 Then
If OneRec = 0 Then
r.MoveFirst
While Not r.EOF
r.delete
r.MoveNext
Wend
Delrec = True
Else
Delrec = False
GoTo 1
End If
Else
r.MoveFirst
r.delete
Delrec = True
End If
1:
r.Close
Set r = Nothing
End Function

, , :

Public Function Delrec(Tbl As String, Whr As Long) As Boolean
Dim sql As String
sql = "DELETE * FROM " & Tbl & " WHERE " & Whr
CurrentDb.Execute sql
End Function


     
 
 
  : 04.09.2006  

| | | | SILICON TAIGA | ISDEF | CD | | | | | | | |

: Silicon Taiga    
Rambler's Top100 Rambler's Top100