Senin, 13 Januari 2014

Re: [belajar-access] [1 Attachment]

 
[Attachment(s) from hari yanto included below]

Jack Rivaldo...,

Ini pandangan saya, membuat form melalui form melalui klik button bisa diandaikan dengan:

1. Membuat form baru melalui form yang sedang open. Bila ini yang dimaksud maka, harus dilakukan via VBA. Dan, itu berarti harus menentukan letak-letak koordinat masing-masing unsur di dalam form. Mulai dari Textbox, label, sampai checkbox.

Contoh script pembuatan form:

Function buat_form(nm_form)
Dim cTxt As Control
    Dim fForm As Form
    Dim s_ttr As String
    Dim mdl As Module
    Dim lngReturn As Long
    Dim db As Database
    Dim tdf As TableDef
    Dim X, t, j As Integer
    Dim ini As Variant
    Dim lbl As Label
    Dim kkc As Variant
   
    'Single Form 0 (Default)
    'Continuous Forms 1
    'Datasheet 2 Displays
    'PivotTable 3 Displays
    'PivotChart 4
   
    ini = "form_coba" 'ini buat caption
    ' set up form
    Set fForm = CreateForm
    fForm.Caption = ini
    fForm.Width = 200
    fForm.Section(0).Height = 200
    fForm.InsideHeight = 200
    fForm.NavigationButtons = False
    fForm.DefaultView = 1
    fForm.ScrollBars = 3
    fForm.RecordSelectors = False
    fForm.AutoResize = True
    fForm.AutoCenter = True
    fForm.PopUp = True
   
    ' add text box
    For X = 0 To 3 'membuat 3 textbox
        Set cTxt = CreateControl(fForm.Name, acTextBox)
            With cTxt
                t = X * 1500
                .Properties("Width") = 1500
                .Properties("Height") = 300
                .Properties("left") = t + 10
                .Properties("Name") = "fi_" & X
                .Properties("ControlSource") = "fi_" & X
                .Properties("TextAlign") = 3 ' right align
            End With
           
          Next X
   
    'buat label
    DoCmd.RunCommand acCmdFormHdrFtr
    Set cTxt = CreateControl(fForm.Name, acLabel, acHeader)
         With cTxt
            .Properties("Width") = 10000
            .Properties("Top") = 400
            .Properties("left") = 10
            .Properties("Height") = 250
            .Properties("FontBold") = 1
            .Properties("Caption") = "INI BUAT JUDUL"
            .Properties("TextAlign") = 1 'left
        End With
               
            For X = 0 To 3
           
                Set cTxt = CreateControl(fForm.Name, acLabel, acHeader)
                With cTxt
                    t = X * 1500
                    .Properties("Width") = 1500
                    .Properties("Top") = 800
                    .Properties("left") = t + 10
                    .Properties("Height") = 250
                    .Properties("BackStyle") = 1
                    .Properties("BackColor") = 5583295
                    .Properties("ForeColor") = 16777215
                    .Properties("BorderStyle") = 1
                    .Properties("Caption") = "Label_" & X
                    .Properties("TextAlign") = 2 'center
                End With
            Next X
   
    s_ttr = fForm.Name
    del_form (s_ttr) 'hapus form bila nama sama dengan nama form sementara
    del_form (nm_form) 'hapus form bila form sudah dibuat dengan nama sama
    DoCmd.Close acForm, s_ttr, acSaveYes 'simpan pembuatan form
    DoCmd.Rename nm_form, acForm, s_ttr 'ubah nama sementara form sesuai kehendak
    subf.SourceObject = nm_form 'letakkan form buatan ke sub form
    subf.Visible = True
End Function

2. Membuka form eksis melalui form yang sekarang dibuka. Ini bisa dilakukan dengan menulis script (misalnya):

DoCmd.OpenForm "COBA"

Sedangkan untuk mempercantik tampilan form, di Ms Access tergolong mudah dilakukan.  Create form ==> Gunakan beberapa alat yang ada menu-menu Ms Access. Kita tinggal drag and drop.

Terlampir contoh mdb 2003 yang membuat form via VBA.

Semoga bisa membantu dan memberi semangat.

Hariyanto (Surabaya)



On Monday, 13 January 2014, 15:11, Jack Rivaldo <rivaldojack@gmail.com> wrote:
 
Pertanyaan saya

1. Bagaimana cara membuat from di dalam from, maksudnya - contoh
ketika di tekan tombol "bottom1" pada from1 akan muncurl "from2"

2. Bagaimana cara mas mempercantik tampilan from, apakah ada tools
khusus untuk mempermudah dalam mendesain from access, kalau ada
sebutkan.

Terima kasih mas atas jawabnnya.


__._,_.___

Attachment(s) from hari yanto

1 of 1 File(s)

Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
Recent Activity:
SPAM IS PROHIBITED
.

__,_._,___

Tidak ada komentar:

Posting Komentar