Predmet:Application.FileSearch Access 2010
Imam ovu funkciju za provjeru da li je račun izaÅ¡ao na fiskalni printer:
PreuzmiIzvorni kôd (Text):Function ProvjeraP(BrojRac As String) As String
Const PutTO = "C:\HCP\TO_FP"
Const PutFrom = "C:\HCP\FROM_FP"
Dim temp As String
Dim ImeF(1 To 2) As String
Dim ImeR(1 To 2) As String
Dim fs, R, F
Dim Brojac As Integer
Dim I As Integer
Dim Putanja_Filea As String
'BrojRac = "Footer.xml"
'BrojRac = " & Me.BROIZD & " ' Broj rac iz polja me.Me.BROIZD + RCP_ tekst
ImeR(1) = "RCP_" & BrojRac & ".XML" ' Broj rac iz polja me.Me.BROIZD + RCP_ tekst
ImeR(2) = "RCP_" & BrojRac & ".ERR"
Provjera1:
Set fs = Application.FileSearch
With fs
.LookIn = PutTO
.FileType = 1
If .Execute > 0 Then
For I = 1 To .foundfiles.Count
F = Right(.foundfiles(I), 3)
If F = "XML" Then
ImeF(1) = .foundfiles(I)
ImeF(1) = ImeFajla(ImeF(1))
If ImeF(1) = ImeR(1) Then
DoEvents
Brojac = Brojac + 1
If Brojac > 3 Then GoTo IZLAZ
Zaustavi (Brojac)
GoTo Provjera1
End If
End If
Next I
End If
End With
Provjera2:
Set fs = Application.FileSearch
With fs
.LookIn = PutFrom
.FileType = 1
If .Execute > 0 Then
For I = 1 To .foundfiles.Count
F = Right(.foundfiles(I), 3)
If F = "ERR" Then
ImeF(2) = ImeFajla(.foundfiles(I))
If ImeF(2) = ImeR(2) Then
Putanja_Filea = .foundfiles(I)
Close #1
Open Putanja_Filea For Input As 1
Input #1, temp
Close #1
MsgBox "Greška:" & temp & "!", vbExclamation, "Ra
un nije fiskaliziran"
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE GLSTAVKEMP1 SET Nefiskaliziran='" & "-1" & "' WHERE BROULIZ='" & Forms.frmIZLAZMP.BROIZD & "'"
DoCmd.SetWarnings True
GoTo Kraj
End If
End If
Next I
End If
End With
Kraj:
Exit Function
IZLAZ:
MsgBox "Ra
un nije ispisan,greška u komunikaciji sa ureajem!", vbExclamation, "Obavijest"
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE GLSTAVKEMP1 SET Nefiskaliziran='" & "-1" & "' WHERE BROULIZ='" & Forms.frmIZLAZMP.BROIZD & "'"
DoCmd.SetWarnings True
BrisiFile (PutTO)
'Kill "C:\HCP\TO_FP\Footer.xml"
'Kill "C:\HCP\TO_FP\RCP_" & Me.BROIZD & ".XML"
'Kill "C:\HCP\TO_FP\CMD.OK"
GoTo Provjera2
GoTo Kraj
End Function
U Access-u 2010 ovo "Set fs = Application.FileSearch" ne postoji.Našao sam link na microsoft-ovim stranicama ali neznam kako to napraviti.Evo link:
Link
Miro
Ovaj post je ureden
3
puta. Posljednja izmjena 02.05.2012 11:30 od strane zxz.