Prikazi cijelu temu 17.03.2011 20:19
Zuko Van mreze
Clan
Registrovan od:13.09.2010
Lokacija:Sarajevo


Predmet:Re: sql upit u VBA-modu
evo koda za usporishell
PreuzmiIzvorni kôd (vbnet):
  1. Option Compare Database
  2. Option Explicit
  3.  
  4.    
  5.    
  6.       Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
  7.       Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
  8.       Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  9.    
  10.       Public Const SYNCHRONIZE = &H100000
  11.    
  12.       Public Const INFINITE = -1&
  13.  
  14.       ' Usporava shel
  15.  
  16.       ' to finish, hiding while we wait.
  17.  
  18.       Public Sub UsporiShell(ByVal program_name As String, ByVal window_style As Integer)
  19.  
  20.       Dim process_id As Long
  21.  
  22.       Dim process_handle As Long
  23.      ' Start the program.
  24.      On Error GoTo ShellError
  25.      process_id = Shell(program_name, window_style)
  26.      On Error GoTo 0
  27.  
  28.           ' Wait for the program to finish.
  29.  
  30.          ' Get the process handle.
  31.  
  32.          process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
  33.  
  34.           If process_handle <> 0 Then
  35.  
  36.               WaitForSingleObject process_handle, INFINITE
  37.  
  38.               CloseHandle process_handle
  39.  
  40.           End If
  41.  
  42.           Exit Sub
  43.  
  44. ShellError:
  45.  
  46.           MsgBox "Error starting task " & _
  47.             " program_name & vbCrLf " & _
  48. " Err.Description , vbOKOnly Or vbExclamation, " & _
  49.                 "Error"
  50.         End Sub
a ovo je sa dugmeta na formi

PreuzmiIzvorni kôd (vbnet):
  1. Private Sub Command7_Click()
  2. Dim g As Integer, d As String, Mjesec1 As String, firma As String, ime As String
  3. g = Year(Now())
  4. firma = DLookup("[Statisticki broj]", "tpreduzece", "Sifra_preduzeca = " & Forms!test!SifraFirme)
  5. d = Len(Forms!test!Mjesec1)
  6. If d = 1 Then
  7. Mjesec1 = "0" & Right(Str(Forms!test!Mjesec1), 1)
  8. Else
  9. Mjesec1 = Str(Forms!test!Mjesec1)
  10. End If
  11. ime = firma & "_" & Mjesec1 & g
  12. UsporiShell Db_Putanja & "\" & pkzip.exe & "  " & ime & ".zip " & Db_Putanja & "\" & ime & ".xml", vbHide
  13. 'UsporiShell putanjafajla & "\pkzip " & PutZipa & "\" & ImeFajla & ".zip " & PutZapisa, vbHide
  14. 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.