Bosna i Hercegovina



zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Subject: Izvjestaj u html
Izvjestaj se moze napraviti i na druge nacine.
Jedan primjer je u prilogu.

Prilozi:
Informacije o fajlu: zip  html.zip
Preuzimanja: 127
Veličina: 28.29 KB


Pozdrav
Ovaj komentar je mijenjan 1 puta. zadnja izmjena 03.03.2012-23:11 od strane zxz. ↑  ↓

roko Offline
Clan
Registrovan/a od: 02.02.2009-00:23
Komentari: 236


Subject: Re: Access trikovi
Msgbox sa sam gasi

Me.TimerInterval = 5000
MsgBox "Nestajem za 5 sekundi."
Me.TimerInterval = 0
↑  ↓

Bosanec Offline
Clan
Registrovan/a od: 02.02.2009-21:12
Komentari: 127


Subject: Isplatnica iz blagajne na starinski način
isplatnica iz blagajne na starinski način

asistencija zxz dorada i obrada bosanec Smiling

možda kome zatreba

pozdrav

Prilozi:
Informacije o fajlu: rar  Isplatnica.rar
Preuzimanja: 96
Veličina: 94.18 KB

Ovaj komentar je mijenjan 1 puta. zadnja izmjena 02.06.2012-23:53 od strane zxz. ↑  ↓

Amelasar Offline
Clan
Registrovan/a od: 07.04.2011-18:28
Komentari: 234


Ocjena: Ocjena:100 Subject: Re: Razlika izmedju dva date/time podatka
DownloadIzvorni kod (Text):
  1. '***************** Code Start **************
  2. Public Function Diff2Dates(Interval As String, Date1 As Variant, Date2 As Variant, _
  3. Optional ShowZero As Boolean = False) As Variant
  4. 'Author:    ) Copyright 2001 Pacific Database Pty Limited
  5. '           Graham R Seach MCP MVP gseach@pacificdb.com.au
  6. '           Phone: +61 2 9872 9594  Fax: +61 2 9872 9593
  7. '           This code is freeware. Enjoy...
  8. '           (*) Amendments suggested by Douglas J. Steele MVP
  9. '
  10. 'Description:   This function calculates the number of years,
  11. '               months, days, hours, minutes and seconds between
  12. '               two dates, as elapsed time.
  13. '
  14. 'Inputs:    Interval:   Intervals to be displayed (a string)
  15. '           Date1:      The lower date (see below)
  16. '           Date2:      The higher date (see below)
  17. '           ShowZero:   Boolean to select showing zero elements
  18. '
  19. 'Outputs:   On error: Null
  20. '           On no error: Variant containing the number of years,
  21. '               months, days, hours, minutes & seconds between
  22. '               the two dates, depending on the display interval
  23. '               selected.
  24. '           If Date1 is greater than Date2, the result will
  25. '               be a negative value.
  26. '           The function compensates for the lack of any intervals
  27. '               not listed. For example, if Interval lists "m", but
  28. '               not "y", the function adds the value of the year
  29. '               component to the month component.
  30. '           If ShowZero is True, and an output element is zero, it
  31. '               is displayed. However, if ShowZero is False or
  32. '               omitted, no zero-value elements are displayed.
  33. '               For example, with ShowZero = False, Interval = "ym",
  34. '               elements = 0 & 1 respectively, the output string
  35. '               will be "1 month" - not "0 years 1 month".
  36.  
  37. On Error GoTo Err_Diff2Dates
  38.  
  39.    Dim booCalcYears As Boolean
  40.    Dim booCalcMonths As Boolean
  41.    Dim booCalcDays As Boolean
  42.    Dim booCalcHours As Boolean
  43.    Dim booCalcMinutes As Boolean
  44.    Dim booCalcSeconds As Boolean
  45.    Dim booSwapped As Boolean
  46.    Dim dtTemp As Date
  47.    Dim intCounter As Integer
  48.    Dim lngDiffYears As Long
  49.    Dim lngDiffMonths As Long
  50.    Dim lngDiffDays As Long
  51.    Dim lngDiffHours As Long
  52.    Dim lngDiffMinutes As Long
  53.    Dim lngDiffSeconds As Long
  54.    Dim varTemp As Variant
  55.  
  56.    Const INTERVALS As String = "dmyhns"
  57.  
  58. 'Check that Interval contains only valid characters
  59.    Interval = LCase$(Interval)
  60.    For intCounter = 1 To Len(Interval)
  61.       If InStr(1, INTERVALS, Mid$(Interval, intCounter, 1)) = 0 Then
  62.          Exit Function
  63.       End If
  64.    Next intCounter
  65.  
  66. 'Check that valid dates have been entered
  67.    If IsNull(Date1) Then Exit Function
  68.    If IsNull(Date2) Then Exit Function
  69.    If Not (IsDate(Date1)) Then Exit Function
  70.    If Not (IsDate(Date2)) Then Exit Function
  71.  
  72. 'If necessary, swap the dates, to ensure that
  73. 'Date1 is lower than Date2
  74.    If Date1 > Date2 Then
  75.       dtTemp = Date1
  76.       Date1 = Date2
  77.       Date2 = dtTemp
  78.       booSwapped = True
  79.    End If
  80.  
  81.    Diff2Dates = Null
  82.    varTemp = Null
  83.  
  84. 'What intervals are supplied
  85.    booCalcYears = (InStr(1, Interval, "y") > 0)
  86.    booCalcMonths = (InStr(1, Interval, "m") > 0)
  87.    booCalcDays = (InStr(1, Interval, "d") > 0)
  88.    booCalcHours = (InStr(1, Interval, "h") > 0)
  89.    booCalcMinutes = (InStr(1, Interval, "n") > 0)
  90.    booCalcSeconds = (InStr(1, Interval, "s") > 0)
  91.  
  92. 'Get the cumulative differences
  93.    If booCalcYears Then
  94.       lngDiffYears = Abs(DateDiff("yyyy", Date1, Date2)) - _
  95.               IIf(Format$(Date1, "mmddhhnnss") <= Format$(Date2, "mmddhhnnss"), 0, 1)
  96.       Date1 = DateAdd("yyyy", lngDiffYears, Date1)
  97.    End If
  98.  
  99.    If booCalcMonths Then
  100.       lngDiffMonths = Abs(DateDiff("m", Date1, Date2)) - _
  101.               IIf(Format$(Date1, "ddhhnnss") <= Format$(Date2, "ddhhnnss"), 0, 1)
  102.       Date1 = DateAdd("m", lngDiffMonths, Date1)
  103.    End If
  104.  
  105.    If booCalcDays Then
  106.       lngDiffDays = Abs(DateDiff("d", Date1, Date2)) - _
  107.               IIf(Format$(Date1, "hhnnss") <= Format$(Date2, "hhnnss"), 0, 1)
  108.       Date1 = DateAdd("d", lngDiffDays, Date1)
  109.    End If
  110.  
  111.    If booCalcHours Then
  112.       lngDiffHours = Abs(DateDiff("h", Date1, Date2)) - _
  113.               IIf(Format$(Date1, "nnss") <= Format$(Date2, "nnss"), 0, 1)
  114.       Date1 = DateAdd("h", lngDiffHours, Date1)
  115.    End If
  116.  
  117.    If booCalcMinutes Then
  118.       lngDiffMinutes = Abs(DateDiff("n", Date1, Date2)) - _
  119.               IIf(Format$(Date1, "ss") <= Format$(Date2, "ss"), 0, 1)
  120.       Date1 = DateAdd("n", lngDiffMinutes, Date1)
  121.    End If
  122.  
  123.    If booCalcSeconds Then
  124.       lngDiffSeconds = Abs(DateDiff("s", Date1, Date2))
  125.       Date1 = DateAdd("s", lngDiffSeconds, Date1)
  126.    End If
  127.  
  128.    If booCalcYears And (lngDiffYears > 0 Or ShowZero) Then
  129.       varTemp = lngDiffYears & IIf(lngDiffYears <> 1, " years", " year")
  130.    End If
  131.  
  132.    If booCalcMonths And (lngDiffMonths > 0 Or ShowZero) Then
  133.       If booCalcMonths Then
  134.          varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  135.                    lngDiffMonths & IIf(lngDiffMonths <> 1, " months", " month")
  136.       End If
  137.    End If
  138.  
  139.    If booCalcDays And (lngDiffDays > 0 Or ShowZero) Then
  140.       If booCalcDays Then
  141.          varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  142.                    lngDiffDays & IIf(lngDiffDays <> 1, " days", " day")
  143.       End If
  144.    End If
  145.  
  146.    If booCalcHours And (lngDiffHours > 0 Or ShowZero) Then
  147.       If booCalcHours Then
  148.          varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  149.                    lngDiffHours & IIf(lngDiffHours <> 1, " hours", " hour")
  150.       End If
  151.    End If
  152.  
  153.    If booCalcMinutes And (lngDiffMinutes > 0 Or ShowZero) Then
  154.       If booCalcMinutes Then
  155.          varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  156.                    lngDiffMinutes & IIf(lngDiffMinutes <> 1, " minutes", " minute")
  157.       End If
  158.    End If
  159.  
  160.    If booCalcSeconds And (lngDiffSeconds > 0 Or ShowZero) Then
  161.       If booCalcSeconds Then
  162.          varTemp = varTemp & IIf(IsNull(varTemp), Null, " ") & _
  163.                    lngDiffSeconds & IIf(lngDiffSeconds <> 1, " seconds", " second")
  164.       End If
  165.    End If
  166.  
  167.    If booSwapped Then
  168.       varTemp = "-" & varTemp
  169.    End If
  170.  
  171.    Diff2Dates = Trim$(varTemp)
  172.  
  173. End_Diff2Dates:
  174.    Exit Function
  175.  
  176. Err_Diff2Dates:
  177.    Resume End_Diff2Dates
  178.  
  179. End Function
  180. '************** Code End *****************


Primjeri pozivanja:

?Diff2Dates("y", #06/01/1998#, #06/26/2002#)
4 years
?Diff2Dates("ymd", #06/01/1998#, #06/26/2002#)
4 years 25 days
?Diff2Dates("ymd", #06/01/1998#, #06/26/2002#, True)
4 years 0 months 25 days
?Diff2Dates("d", #06/01/1998#, #06/26/2002#)
1486 days

?Diff2Dates("h", #01/25/2002 01:23:01#, #01/26/2002 20:10:34#)
42 hours
?Diff2Dates("hns", #01/25/2002 01:23:01#, #01/26/2002 20:10:34#)
42 hours 47 minutes 33 seconds
?Diff2Dates("dhns", #01/25/2002 01:23:01#, #01/26/2002 20:10:34#)
1 day 18 hours 47 minutes 33 seconds

?Diff2Dates("ymd",#12/31/1999#,#1/1/2000#)
1 day
?Diff2Dates("ymd",#1/1/2000#,#12/31/1999#)
-1 day
?Diff2Dates("ymd",#1/1/2000#,#1/2/2000#)
1 day
Pozdrav, Amela
↑  ↓

zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Subject: Naredba StrComp
Jeste li znali za naredbu Strcomp

StrComp(string1,string2,nacin)
Iz Helpa:
Dim MyStr1, MyStr2, MyComp
MyStr1 = "ABCD": MyStr2 = "abcd"    ' Define variables.
MyComp = StrComp(MyStr1, MyStr2, 1)    ' Returns 0.
MyComp = StrComp(MyStr1, MyStr2, 0)    ' Returns -1.
MyComp = StrComp(MyStr2, MyStr1)    ' Returns 1.

Uspoređuje stringove "string1" i "string2" i vraća 0 ako su jednaki, -1 ako je "string1" manji od "string2" i 1 ako je "string2" manji od "string1" .
"nacin" predstavlja način usporedbe stringova i može biti binaran (nacin=0 =≫ pravi se razlika između velikih i malih slova) i tekstualan (nacin=1 =≫ ne pravi se razlika između velikih i malih slova). Ako se "nacin" ne navede, podrazumijevano je binarna usporedba.
Npr:
StrComp("VBA","vba",0) vraća -1
StrComp("VBA","vba",1) vraća 0
Pozdrav
↑  ↓

zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Subject: Partition u SQL-u
Jeste li koristili Partition?
Mislim da vecina nije.
Koristimo je Kada zelimo zbrajati neke podatke u Sa odredjenim Intervalima:
Primjer.
Ako imamo Tablicu Koja se zove Osobe i U njoj Polja:
Id
Ime
Prezime
Starost

Sada zelimo da Imamo podatke o broju osoba po starosti a u intervalu po 5 godina.
Znaci od 1-5 od 5-10 itd

Evo SQL:
DownloadIzvorni kod (SQL):
  1. SELECT Partition([Starost],1,100,5) AS Raspon, Count(Starost) AS Broj
  2. FROM Osobe
  3. GROUP BY Partition([Starost],1,100,5);

Pozdrav
↑  ↓

zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Subject: Naredba Choose
Dali ste nekada koristili naredbu Choose.
Evo primjer.
DownloadIzvorni kod (Visual Basic):
  1. Function ChooseF()
  2. Dim A As String
  3.  
  4. A = Choose(3, "mujo", "pero", "haso", "vitomir")
  5. ChooseF = A
  6. End Function

Pozdrav
↑  ↓

zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Subject: Naredba NZ
dali koristite naredbu NZ?
Ponekad zatreba.
Sa NZ Mozemo odrediti neku drugu vrijednost kada je vrijednost Null.
Primjer:
DownloadIzvorni kod (Visual Basic):
  1. Function PrimjerNZ()
  2. Dim a, b, c
  3.  
  4. a = Null
  5. b = Nz(a, "Nul Vrijednost")
  6. a = 22
  7. c = Nz(a, "Nul Vrijednost")
  8. End Function

Pozdrav
↑  ↓

dex Offline
Super Moderator
Registrovan/a od: 23.02.2012-19:59
Komentari: 545


Subject: Re: Access trikovi
Koristim, samo mi reci je li to Accessova naredba ili je prepoznaju i drugi DBMS?
↑  ↓

zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Subject: Re: Access trikovi
Nz je accessova naredba nalazi se u biblioteci msacc.olb.
Pozdrav
↑  ↓

roko Offline
Clan
Registrovan/a od: 02.02.2009-00:23
Komentari: 236


Subject: Fadein & Out Forme
Fade in out Form

Modul :
DownloadIzvorni kod (Visual Basic):
  1. Option Compare Database
  2. Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  3. (ByVal hWnd As Long, ByVal nIndex As Long) As Long
  4. Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  5. (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  6. Public Declare Function SetLayeredWindowAttributes Lib "user32" _
  7. (ByVal hWnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
  8. Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  9. Public Const GWL_EXSTYLE = (-20)
  10. Public Const WS_EX_LAYERED = &H80000
  11. Public Const WS_EX_TRANSPARENT = &H20&
  12. Public Const LWA_ALPHA = &H2&
  13. Public Enum FadeDirection
  14.    Fadein = -1
  15.    Fadeout = 0
  16.    Fadezero = 1
  17.    SetOpacity = 1
  18. End Enum
  19. Public Sub FadeForm(frm As Form, Optional Direction As FadeDirection = FadeDirection.Fadein, _
  20. Optional iDelay As Integer = 0, Optional StartOpacity As Long = 5)
  21. If frm Is Nothing Then: Exit Sub
  22. On Error GoTo van
  23.    Dim lOriginalStyle As Long
  24.    Dim iCtr As Integer
  25.    If (frm.PopUp = True) Then
  26.        lOriginalStyle = GetWindowLong(frm.hWnd, GWL_EXSTYLE)
  27.        SetWindowLong frm.hWnd, GWL_EXSTYLE, lOriginalStyle Or WS_EX_LAYERED
  28.        If (lOriginalStyle = 0) And (Direction <> FadeDirection.SetOpacity) Then
  29.           FadeForm frm, SetOpacity, , StartOpacity
  30.        End If
  31.        Select Case Direction
  32.           Case FadeDirection.Fadezero
  33.               iCtr = StartOpacity
  34.               SetLayeredWindowAttributes frm.hWnd, 0, CByte(iCtr), LWA_ALPHA
  35.           Case FadeDirection.Fadein
  36.               If StartOpacity < 1 Then StartOpacity = 1
  37.               For iCtr = StartOpacity To 255 Step 1
  38.                  SetLayeredWindowAttributes frm.hWnd, 0, CByte(iCtr), LWA_ALPHA
  39.                  DoEvents
  40.                '  Debug.Print iCtr
  41.                 Sleep iDelay
  42.               Next
  43.           Case FadeDirection.Fadeout
  44.               If StartOpacity < 6 Then StartOpacity = 255
  45.               For iCtr = StartOpacity To 1 Step -1
  46.                  SetLayeredWindowAttributes frm.hWnd, 0, CByte(iCtr), LWA_ALPHA
  47.                  DoEvents
  48.                  Sleep iDelay
  49.               Next
  50.           Case Else
  51.               Select Case StartOpacity
  52.                  Case Is < 1: StartOpacity = 1
  53.                  Case Is > 255: StartOpacity = 255
  54.               End Select
  55.               SetLayeredWindowAttributes frm.hWnd, 0, CByte(StartOpacity), LWA_ALPHA
  56.                  DoEvents
  57.                  Sleep iDelay
  58.        End Select
  59.    Else
  60.        MsgBox "Forma mora biti Popup", vbOKOnly & vbInformation, "Ne
  61. e ii"
  62.    End If
  63. van:
  64. End Sub
Poziv na formi:
DownloadIzvorni kod (Visual Basic):
  1. Option Compare Database
  2. Dim MojInt
  3. Private Sub Form_Open(Cancel As Integer)
  4. Me.TimerInterval = 2
  5. FadeForm Me, Fadezero, 1, 5
  6. End Sub
  7. Private Sub Form_Timer()
  8. On Error Resume Next
  9. If IsEmpty(MojInt) Then
  10.     FadeForm Me, Fadein, 1, 15
  11.    MojInt = 1
  12. End If
  13.  Me.TimerInterval = 0
  14. End Sub


Prilozi:
Informacije o fajlu: rar  Fade_in_out.rar
Preuzimanja: 84
Veličina: 29.98 KB

↑  ↓

miro35 Offline
Moderator
Registrovan/a od: 05.01.2009-15:56
Komentari: 609


Subject: Isključivanje/Uključivanje Shift-a za ulazak u bazu
Vjerovatno već imamo isključivanje i uključivanje shift tipke za ulazak u bazu ali nisam siguran da imamo ovaj primjer po meni najjednostavniji.
Prvo stavimo ovu funkciju u jedan modul:
DownloadIzvorni kod (Text):
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Public Function SetProperties(strPropName As String, _
  5. varPropType As Variant, varPropValue As Variant) As Integer
  6.  
  7.     On Error GoTo Err_SetProperties
  8.  
  9.     Dim db As DAO.Database, prp As DAO.Property
  10.  
  11.     Set db = CurrentDb
  12.     db.Properties(strPropName) = varPropValue
  13.     SetProperties = True
  14.     Set db = Nothing
  15.  
  16. Exit_SetProperties:
  17.     Exit Function
  18.  
  19. Err_SetProperties:
  20.     If Err = 3270 Then    'Property not found
  21.         Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
  22.         db.Properties.Append prp
  23.         Resume Next
  24.     Else
  25.         SetProperties = False
  26.         MsgBox "SetProperties", Err.Number, Err.Description
  27.         Resume Exit_SetProperties
  28.     End If
  29. End Function
Zatim na neku formu najbolje ulaznu formu stavimo command buton "bDisableBypassKey"
Na click tog dugmeta će biti ovo:
DownloadIzvorni kod (Text):
  1. Private Sub bDisableBypassKey_Click()
  2. On Error GoTo Err_bDisableBypassKey_Click
  3.    
  4.     Dim strInput As String
  5.     Dim strMsg As String
  6.    
  7.     BEEP
  8.     strMsg = "Da li želite uklju
  9. iti Shift Tipku za aplikaciju?" & vbCrLf & vbLf & "Molim unesite programerski password za ovu opciju."
  10.     strInput = InputBox(Prompt:=strMsg, Title:="Uklju
  11. i Shift passwordom ili isklju
  12. i")
  13.    
  14.     If strInput = "Ovde password" Then
  15.         SetProperties "AllowBypassKey", dbBoolean, True
  16.         BEEP
  17.         MsgBox "Funkcija izvršena." & vbCrLf & vbLf & "Shift Tipka je uklju
  18. ena prilikom sljedeeg pokretanja aplikacije.", vbInformation, "Startup uklju
  19. en"
  20.     Else
  21.         BEEP
  22.         SetProperties "AllowBypassKey", dbBoolean, False
  23.         MsgBox "Pogrešno ''Klju
  24. '' Password!" & vbCrLf & vbLf & "Shift tipka je isklju
  25. ena." & vbCrLf & vbLf & "Shift tipka je isklju
  26. ena prilikom sljedeeg pokretanja aplikacije.", vbCritical, "Pogrešan password"
  27.         Exit Sub
  28.     End If
  29.    
  30. Exit_bDisableBypassKey_Click:
  31.     Exit Sub
  32.    
  33. Err_bDisableBypassKey_Click:
  34.     MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
  35.     Resume Exit_bDisableBypassKey_Click
  36. End Sub
Vidite u ovom codu gdje piše Ovde password tu stavite svoju lozinku.
Ovaj način je dobar kad želite da uključite Shift ukucate ispravnu lozinku,a kada želite da isključite Shift onda samo ukucate krivu lozinku ili pritisnete tipku cancel.
Napomena:Ovo isprobajte na nekoj praznoj bazi pa tek onda primjenite na svoju.
Miro
↑  ↓

zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Subject: Re: Access trikovi
Kopirajte ovaj kod u vas izvjestaj ukoliko zelite da vam izvjestaj bude uokviren.
DownloadIzvorni kod (Visual Basic):
  1. Private Sub Report_Page()
  2.        On Error Resume Next
  3.          Me.DrawWidth = 6
  4.          Me.DrawStyle = 0
  5.          Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), vbGreen, B
  6. End Sub

Pozdrav
↑  ↓

zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Ocjena: Ocjena:100 Subject: Re: Access trikovi
I ovo je jedan mali trik za uljepsavanje vase app.

Prilozi:
Informacije o fajlu: zip  LabelaTrik.zip
Preuzimanja: 85
Veličina: 7.55 KB


Pozdrav
↑  ↓

zxz Offline
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,388


Subject: Re: Access trikovi
Obratite paznju da je u recordsource obje forme isti query.
Mozda vam padne ideja da ovo negdje i iskoristite.

Prilozi:
Informacije o fajlu: zip  QueryTrik.zip
Preuzimanja: 86
Veličina: 32.65 KB


Pozdrav
↑  ↓

 Podijeli  Dodaj odgovor Stranice (7): 1, 2, 3, 4, 5, 6, 7


All times are GMT +01:00. Current time: 23.07.2017-09:46.