Public Function PrevzemiPodatoci() As Boolean '------------------------------------------------------------------------------------------------- 'Konekcija na bazata za prenos Set cnPren = New ADODB.Connection cnPren.ConnectionString = "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\KASA\TEMP.mdb" '& App.path & "\TEMP.mdb" & ";" cnPren.Open If cnPren.State = adStateOpen Then frmLogin.labInfo.Visible = True For i = 1 To 12 Select Case i Case 1 If AzurirajTabeli("ID_Magacin", "tblMagacini") = True Then frmLogin.labInfo.Caption = "> AZURIRAM MAGACINI " Case 2 If AzurirajTabeli("KasaID", "tblKasi") = True Then frmLogin.labInfo.Caption = "> AZURIRAM KASI " Case 3 If AzurirajTabeli("ID_Vraboten", "tblVraboteni") = True Then frmLogin.labInfo.Caption = "> AZURIRAM VRABOTENI " Case 4 If AzurirajTabeli("ID_Grupa_Artikal", "tblGrupa_Artikli") = True Then frmLogin.labInfo.Caption = "> AZURIRAM GRUPI NA ARTIKLI " Case 5 If AzurirajTabeli("ID_Grupa_Komitent", "tblGrupi_Komitenti") = True Then frmLogin.labInfo.Caption = "> AZURIRAM GRUPI NA KOMITENTI " Case 6 If AzurirajTabeli("ID_Tip_Trosak", "tblTip_Trosoci") = True Then frmLogin.labInfo.Caption = "> AZURIRAM TIPONI TROSOCI " Case 7 If AzurirajTabeli("ID_Vid_Dokument", "tblDokumenti") = True Then frmLogin.labInfo.Caption = "> AZURIRAM TIPOVI DOKUMENTI " Case 8 If AzurirajTabeli("ID_Artikal", "tblArtikli") = True Then frmLogin.labInfo.Caption = "> AZURIRAM ARTIKLI " Case 9 If AzurirajTabeli("ID_Komitent", "tblKomitenti") = True Then frmLogin.labInfo.Caption = "> AZURIRAM KOMITENTI " Case 10 If AzurirajTabeli("Tarifa", "tblTarifi") = True Then frmLogin.labInfo.Caption = "> TARIFI " Case 11 If AzurirajTabeli("ID_Valuta_Kurs", "tblValuti_Kurs") = True Then frmLogin.labInfo.Caption = "> AZURIRAM KURSNI LISTI " Case 12 If AzurirajTabeli("ID_Popust", "tblPopusti") = True Then frmLogin.labInfo.Caption = "> AZURIRAM POPUSTI " End Select DoEvents Next frmLogin.labInfo.Caption = "> AZURIRAJNETO ZAVRSI " frmLogin.labInfo.Visible = False frmLogin.cmdPrenosVoUSB.Visible = False frmLogin.cmdPrezemiOdUSB.Visible = False frmLogin.txtSifra = "" cnPren.Close End If End Function Private Function AzurirajTabeli(ID_Pole As String, Tabela As String) As Boolean On Error GoTo ErrAzuriraj: Dim rsServer As ADODB.Recordset ' Tabela vo kasa Dim rsPren As ADODB.Recordset ' Tabela za pezemajne Dim rsAzuriraj As ADODB.Recordset ' Tabela za pezemajne AzurirajTabeli = False Set rsPren = New ADODB.Recordset rsPren.Open "SELECT * FROM " & Tabela, cnPren, adOpenKeyset, adLockOptimistic Set rsServer = New ADODB.Recordset rsServer.Open "SELECT * FROM " & Tabela, cn, adOpenStatic, adLockOptimistic If rsPren.RecordCount > 0 Then rsPren.MoveFirst Do While Not rsPren.EOF If DLookup(ID_Pole, Tabela, ID_Pole & "=" & rsPren.Fields(ID_Pole)) <> "" Then '============================================================================== ' Se azurira postoeckiot artikal Set rsAzuriraj = New ADODB.Recordset rsAzuriraj.Open "SELECT * FROM " & Tabela & " WHERE " & ID_Pole & "=" & rsPren.Fields(ID_Pole), cn, adOpenStatic, adLockOptimistic rsAzuriraj.MoveFirst For i = 1 To (rsPren.Fields.Count - 1) If rsPren.Fields(i).Value = "" Then Else rsAzuriraj.Fields(rsPren.Fields(i).Name) = rsPren.Fields(i) frmLogin.labInfo.Caption = "> AZURIRAM - " & rsPren.Fields(i) DoEvents End If Next rsAzuriraj.Update rsAzuriraj.Close '================================================================================ Else '================================================================================ ' Se dodava nov artikal ako ne postoi rsServer.AddNew For i = 0 To (rsPren.Fields.Count - 1) If rsPren.Fields(i).Value = "" Then Else rsServer.Fields(rsPren.Fields(i).Name) = rsPren.Fields(i) frmLogin.labInfo.Caption = "> DODAVAM - " & rsPren.Fields(i) DoEvents End If Next rsServer.Update '================================================================================= End If rsPren.MoveNext Loop End If AzurirajTabeli = True ErrAzuriraj: If Err <> 0 Then AzurirajTabeli = False End Function