Sunteți pe pagina 1din 3

Option Compare Database Option Explicit ''' HACER TRANSPARENTE EL FORMULARIO Private Const LWA_ALPHA = &H2 Private Const

GWL_EXSTYLE = (-20) Private Const WS_EX_LAYERED = &H80000 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long Private Declare Sub apiRGB Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, src As Any, ByVal Length As Long) Public Transparencia As Integer Public Abrir As Boolean Private Sub Filtro2_AfterUpdate() Dim origen As String origen = "Select * from Referencias" If Me![Filtro2] <> "Todas las plazas" Then origen = origen & " Where ((Referencias.Plaza)= Forms![Referencias]![filtro2]);" Else origen = origen & ";" End If Me.RecordSource = origen Me.Requery End Sub Private Sub Filtro_AfterUpdate() Dim origen As String origen = "Select * from Referencias" If Me![Filtro] <> "Todos los servicios" Then origen = origen & " Where ((Referencias.Servicio)= Forms![Referencias]![filtro]);" Else origen = origen & ";" End If Me.RecordSource = origen Me.Requery End Sub Private Sub Cuadro_combinado24_AfterUpdate() ' Buscar el registro que coincida con el control. Dim rs As Object Set rs = Me.Recordset.Clone rs.FindFirst "[Referencia] = '" & Me![Cuadro combinado24] & "'" If Not rs.EOF Then Me.Bookmark = rs.Bookmark End Sub

Private Sub Form_Load() Abrir = True ''' abrimos el form en modo transparente total (invisible) para ir haciendolo visible ''' progresivamente SetWindowLong hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED SetLayeredWindowAttributes hwnd, 0, 0, LWA_ALPHA ''' ponemos a cero la variable publica para decirle a la funcion timer que ha de contra ''' hacia delante, el form es completamente transparente y se tiene que hacer visible ''' progresivamente Transparencia = 0 ''' iniciamos el timer con el valor minimo para observar el efecto, el intervalo ''' 1 crea un efecto muy suave Me.TimerInterval = 2 ' tamao del formulario 'Me.InsideHeight = 5735 'Me.InsideWidth = 10755 ' eliminamos filtro y orden Me.Filter = ""

Me.FilterOn = False Me.OrderBy = "" Me.OrderByOn = False txtRegistros = DCount("[IdReferencia]", "Referencias") ' si en el form esta si la opcion ' permitir agregar activa el boton que lo permite 'If AllowAdditions = False Then 'ImagenAadirPulsado.Visible = True ' Else ' ImagenAadirPulsado.Visible = False 'End If End Sub Private Sub Form_Open(Cancel As Integer) DoCmd.Close acForm, "SubMenu4v" DoCmd.Close acForm, "SubMenu4vt" DoCmd.Close acForm, "SubMenu3cb" DoCmd.Close acForm, "SubMenu3op" DoCmd.Close acForm, "SubMenu3py" DoCmd.Close acForm, "SubMenu3ad" End Sub Private Sub Form_Close() With CodeContextObject If (.Tex99 = "GVtas") Then DoCmd.OpenForm "SubMenu4vt", acNormal, "", "", , acNormal End If End With With CodeContextObject If (.Tex99 = "Presupuestos1") Then DoCmd.OpenForm "SubMenu4v", acNormal, "", "", , acNormal End If End With With CodeContextObject If (.Tex99 = "Cobranzas") Then DoCmd.OpenForm "SubMenu3cb", acNormal, "", "", , acNormal End If End With With CodeContextObject If (.Tex99 = "Operaciones") Then DoCmd.OpenForm "SubMenu3op", acNormal, "", "", , acNormal End If End With With CodeContextObject If (.Tex99 = "Proyectos") Then DoCmd.OpenForm "SubMenu3py", acNormal, "", "", , acNormal End If End With With CodeContextObject If (.Tex99 = "Administracin") Then DoCmd.OpenForm "SubMenu3ad", acNormal, "", "", , acNormal End If End With End Sub Private Sub Form_Timer() If Abrir = False Then Transparencia = Transparencia - 10 If Transparencia > 0 Then SetWindowLong hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED SetLayeredWindowAttributes hwnd, 0, Transparencia, LWA_ALPHA Else DoCmd.Close End If End If If Abrir = True Then Transparencia = Transparencia + 10 If Transparencia < 255 Then

SetWindowLong hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED SetLayeredWindowAttributes hwnd, 0, Transparencia, LWA_ALPHA Else TimerInterval = 0 End If End If End Sub ' ORDENAR EL FORMULARIO ' aqui ordenamos de forma ascendente o ' descendente dependiendo de su estado anterior ' tambien hacemos visible una flechita al lado del ' nombre del campo que indica el orden e identifica ' el campo por el cual esta ordenado el formulario Function Ordena(Campo As String, EtiquetaPulsada As Control) Me.OrderByOn = True If Me.OrderBy = Campo & " DESC" Then Me.OrderBy = Campo ImagenAbajo.Visible = True ImagenArriba.Visible = False ImagenAbajo.Top = EtiquetaPulsada.Top + 90 ImagenAbajo.Left = EtiquetaPulsada.Left + 110 Else Me.OrderBy = Campo & " DESC" ImagenAbajo.Visible = False ImagenArriba.Visible = True ImagenArriba.Top = EtiquetaPulsada.Top + 90 ImagenArriba.Left = EtiquetaPulsada.Left + 110 End If End Function

S-ar putea să vă placă și