Access'te Otomatik Form Çalıştırma

Kodla Büyü

masci

Seçkin Üye
Seçkin Üye
Mesajlar
384
access 2007 de form görünümlü kayıt ekranı nasıl elde ediyorduk arkadaşlar...

direkt form görünümünde açılsın istiyorum
 
Access 2007 için anlatıyorum.
daha önce basit bir anasınıfı öğrenci kayıt programı yaparken araştırmıştım, program kodlarını buraya ekliyorum.

ilk olarak access çalışmanızda bir modül oluşturun ve aşağıdaki kodları yazın.
Oluştur Sekmesi -> Diğer Grubu -> Makro -> Modül
Kod:
Option Compare Database
Option Explicit

Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3

Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long

' This function is to be called as such:
' Call fSetAccessWindow (argument)
' The arguments are as follows;
' SW_HIDE - this hides the access database window
' SW_SHOWMAXIMIZED - this maximizes the window
' SW_SHOWMINIMIZED - this minimizes the window
' SW_SHOWNORMAL - this just shows (as normal) the window


Function fSetAccessWindow(nCmdShow As Long)
'Usage Examples
'Maximize window:
' ?fSetAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
' ?fSetAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
' ?fSetAccessWindow(SW_HIDE)
'Normal window:
' ?fSetAccessWindow(SW_SHOWNORMAL)
'
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm

If Err <> 0 Then
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If

If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
fSetAccessWindow = (loX <> 0)
End Function
otomatik açılmasını istediğiniz formun "Yüklendiğinde" olayına
Kod:
fSetAccessWindow (SW_SHOWMINIMIZED)
kodunu yazın.

Form'un Diğer sekmesindeki "Açılan" ve "Kalıcı" özelliklerinide "Evet" olarak ayarlayın.
 
hocam birşeyi de unutmadan
Office Düğmesi -> Access Seçenekleri -> Geçerli Veritabanı -> Form Görüntüle bölümünden de açılmasını istediğiniz formu seçmeniz gerekiyor.
 
Geri
Üst