Archivo

Archivo para Mayo 2007

Bordes en informes

When creating reports in Microsoft Access there are certain formatting options that can be applied whilst in design view of the database report. You may wish to add Lines or Rectangles to frame specific areas of the report to ensure that these stand out amongst the other information.

There are also options available to create Borders around the entire page of an Access report, and using the simple code below will allow you to do this:

Since you want to modify the page, it makes sense to put this code in the Report_Page() event.

 Private Sub Report_Page()
    On Error Resume Next
        'Set Thickness and Border Style

        'Larger Number creates Thicker Line
        Me.DrawWidth = 1
        'Values 0 to 6 = Solid Line to Invisible
        Me.DrawStyle = 2

        'Object.Line (x1, y1) - (x2,y2), color, [Box=B]
        Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), vbRed, B
 End Sub
Categorías:Microsoft Access

Sobre medidas


twips = 1440 * inches
inches = twips / 1440

twips = 1440 * cm / 2.54
cm = 2.54 * twips/1440

Categorías:Microsoft Access

Resize form

18.05.2007 lumbanico 1 Comentario

Para resizar el form, simple y delicado… no es mio, ni se de donde lo he sacado, pero va que te las pelas de bien. Si alquien conoce al auto, por favor que me lo diga.

[/sourcecode]
Public ALTURA, ANCHO, DERECHA, IZQUIERDA, BUCLE
Private Sub Form_Load()
BUCLE = 0
ALTURA = Me.InsideHeight
ANCHO = Me.InsideWidth
End Sub

Private Sub Form_Resize()
Dim queobjeto As String
If Me.InsideHeight > 2000 Then
Dim OBJECTO As Object
Dim RESALTURA, RESANCHO
If BUCLE > 0 Then
RESALTURA = ((Val(Me.InsideHeight) * 100) / ALTURA)
RESANCHO = ((Val(Me.InsideWidth) * 100) / ANCHO)
For Each OBJECTO In Controls
OBJECTO.Height = ((Val(OBJECTO.Height) * RESALTURA) / 100)
OBJECTO.Width = ((Val(OBJECTO.Width) * RESANCHO) / 100)
‘OBJECTO.top = ((Val(OBJECTO.top) * RESALTURA) / 100)
OBJECTO.left = ((Val(OBJECTO.left) * RESANCHO) / 100)
Next OBJECTO
End If
BUCLE = BUCLE + 1
ALTURA = Me.InsideHeight
ANCHO = Me.InsideWidth
End If
Me.Repaint
End Sub
[/sourceobject]

Nota: al “OBJETO.top” da problemas, no lo he resuelto todavia , si alquien lo arregla que avise.

Categorías:Microsoft Access

Inactividad del ratón y del teclado

Option Explicit

Const cTiempo As Single = 5   'Tiempo de Inactividad
Dim sHora As Single
Dim sSegundos As Single

Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Rem controlo la inactividad del raton
sSegundos = cTiempo
sHora = Timer
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Rem controlo la inactividad del teclado
sSegundos = cTiempo
sHora = Timer
End Sub

Private Sub Form_Load()
Me.KeyPreview = True
Me.TimerInterval = 1000  '1000 = 1 segundo
sSegundos = cTiempo
sHora = Timer
End Sub

Private Sub Form_Timer()
If Timer - sHora > sSegundos Then
DoEvents  'Se podria suprimir para ganar algo de velocidad
Else
DoCmd.Quit  'Aqui te sacaria del programa
MsgBox "Vuelve a contar"
sSegundos = cTiempo
sHora = Timer
End If
End Sub

Fuente: Javier Gomez

Categorías:Microsoft Access Etiquetas:, ,

Inactividad en el form

‘Control de inactividad                      ‘
”””””””””””””””””””””””
‘Ejemplo que muestra como se puede usar la   ‘
‘API de Windows y la propiedad KeyPreview    ‘
‘para detectar si se está trabajando en el   ‘
‘programa o no (similar al funcionamiento del’
‘protector de pantalla de Windows).          ‘
”””””””””””””””””””””””
‘Escrito por Gustavo Alegre                  ‘
‘Junio del 2003                              ‘
‘Descargado de Visual Basic siglo XII        ‘
‘www.vbsiglo21.com                           ‘
”””””””””””””””””””””””
”””””””””””””””””””””””

Dim pt32 As POINTAPI
Dim ptx As Long
Dim pty As Long
Private Declare Function GetCursorPos Lib “user32″ (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim contador As Integer

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
contador = 0
End Sub

Private Sub Form_Timer()
ptx = pt32.X
pty = pt32.Y
Call GetCursorPos(pt32)
‘Label1.Caption = pt32.X & ” ” & pt32.Y
If pt32.X = ptx And pt32.Y = pty Then
contador = contador + 1
If contador = 5 Then
‘MsgBox “Han pasado 5 segundos de inactividad”, vbInformation
dfSuche = “”: dfSuche.SetFocus: dfSuche.SelStart = Nz(Len(dfSuche), 1)
contador = 0
End If
Else
contador = 0
End If
End Sub

Yo lo uso en un form de busqueda para que el personal trabaje lo menos posible. Tremendamente util y simple

Categorías:Microsoft Access

Función Environ

Sub test()
    Dim i As Integer
    Dim stEnviron As String
    For i = 1 To 50
        ' get the environment variable
        stEnviron = Environ(i)
        ' see if there is a variable set
        If Len(stEnviron) > 0 Then
            Debug.Print i, Environ(i)
        Else
            Exit For
        End If
    Next
End Sub

1            ALLUSERSPROFILE=C:\Documents and Settings\All Users
2            APPDATA=C:\Documents and Settings\feste\Application Data
3            CommonProgramFiles=C:\Program Files\Common Files
4            COMPUTERNAME=CM-MO-AD-20
5            ComSpec=C:\WINDOWS\system32\cmd.exe
6            FP_NO_HOST_CHECK=NO
7            HOMEDRIVE=C:
8            HOMEPATH=\Documents and Settings\feste
9            LOGONSERVER=\\CHENSVR3
10           NUMBER_OF_PROCESSORS=2
11           OS=Windows_NT
12           Path=C:\Program Files\Microsoft Office\Office\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI.ACE\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\
13           PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
14           PROCESSOR_ARCHITECTURE=x86
15           PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 9, GenuineIntel
16           PROCESSOR_LEVEL=15
17           PROCESSOR_REVISION=0409
18           ProgramFiles=C:\Program Files
19           SESSIONNAME=Console
20           SystemDrive=C:
21           SystemRoot=C:\WINDOWS
22           TEMP=C:\DOCUME~1\feste\LOCALS~1\Temp
23           TMP=C:\DOCUME~1\feste\LOCALS~1\Temp
24           USERDNSDOMAIN=CHENMED
25           USERDOMAIN=CHENMED
26           USERNAME=FEste
27           USERPROFILE=C:\Documents and Settings\feste
28           windir=C:\WINDOWS

Categorías:Microsoft Access