Predmet:Re: sql upit u VBA-modu
evo koda za usporishell
PreuzmiIzvorni kôd (vbnet):Option Compare Database
Option Explicit
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Const SYNCHRONIZE = &H100000
Public Const INFINITE = -1&
' Usporava shel
' to finish, hiding while we wait.
Public Sub UsporiShell(ByVal program_name As String, ByVal window_style As Integer)
Dim process_id As Long
Dim process_handle As Long
' Start the program.
On Error GoTo ShellError
process_id = Shell(program_name, window_style)
On Error GoTo 0
' Wait for the program to finish.
' Get the process handle.
process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
If process_handle <> 0 Then
WaitForSingleObject process_handle, INFINITE
CloseHandle process_handle
End If
Exit Sub
ShellError:
MsgBox "Error starting task " & _
" program_name & vbCrLf " & _
" Err.Description , vbOKOnly Or vbExclamation, " & _
"Error"
End Sub
a ovo je sa dugmeta na formi
PreuzmiIzvorni kôd (vbnet):Private Sub Command7_Click()
Dim g As Integer, d As String, Mjesec1 As String, firma As String, ime As String
g = Year(Now())
firma = DLookup("[Statisticki broj]", "tpreduzece", "Sifra_preduzeca = " & Forms!test!SifraFirme)
d = Len(Forms!test!Mjesec1)
If d = 1 Then
Mjesec1 = "0" & Right(Str(Forms!test!Mjesec1), 1)
Else
Mjesec1 = Str(Forms!test!Mjesec1)
End If
ime = firma & "_" & Mjesec1 & g
UsporiShell Db_Putanja & "\" & pkzip.exe & " " & ime & ".zip " & Db_Putanja & "\" & ime & ".xml", vbHide
'UsporiShell putanjafajla & "\pkzip " & PutZipa & "\" & ImeFajla & ".zip " & PutZapisa, vbHide
End Sub
ovdje sam pravio ime file-a, valjda je to ok
Pozdav,
Nedim
Ovaj post je ureden
1
puta. Posljednja izmjena 17.03.2011 20:21 od strane nzuko.