ник: АлаяЗаря
Private Function connection()
Dim rst As ADODB.Recordset
Dim conn As ADODB.connection
Dim bdd As Database
Dim rs As Recordset
Dim strselect As String
Dim strwhere As String
Dim a As String
Dim b As String
Set rst = New ADODB.Recordset
Set conn = New ADODB.connection
conn.Open "Provider=PostgreSQL;Data Source=localhost;location=sotrudniki;User ID=postgres;password=1;"
strselect = "select * from fio"
rst.Open strselect, conn
a = rst.RecordCount ' пишет -1
Set bdd = DBEngine.Workspaces(0).OpenDatabase("D:\connect_be.mdb")
Set rs = bdd.OpenRecordset("fio", dbOpenTable): rs.Index = "PrimaryKey"
Do While Not rst.EOF
rs.AddNew
rs.Fields(1).Value = rst.Fields(1).Value 'rst.Fields(0)name
rs.Fields(2).Value = rst.Fields(0).Value 'rst.Fields(1)fam
rs.Fields(3).Value = rst.Fields(4).Value 'rst.Fields(2)tel
rs.Fields(4).Value = rst.Fields(2).Value 'rst.Fields(3)adres
rs.Fields(5).Value = rst.Fields(3).Value 'rst.Fields(4)ot
rs.Update
rst.MoveNext
Loop
End Function
|
не получается никак определить количество записей в рекордсете =(