Bismillahirrohmanirrohim...,
Kalau pengalaman saya begini. Setelah create tabel, tabel tersebut saya edit via VBA dengan cara:
Call GAE (nama_tabel, nama_field_checkbox, nama_field_date)
Script GAE itu dibawah ini:
Private Sub GAE(tb As String, field1 As String, field2 As String)
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim db As Database
Dim strSql As String
Dim prp As DAO.Property
Set db = CurrentDb
'It is now in the table collection, so ...
Set tdf = db.TableDefs(tb)
'Change the way the YesNo fields display.
'A Checkbox
Set fld = tdf.Fields(field1)
Set prp = fld.CreateProperty("DisplayControl", dbInteger, acCheckBox)
fld.Properties.Append prp
Set fld = tdf.Fields(field1)
Set prp = fld.CreateProperty("Format", dbText, "Yes/No")
fld.Properties.Append prp
Set fld = tdf.Fields(field2)
Set prp = fld.CreateProperty("Format", dbText, "Long Date")
fld.Properties.Append prp
db.Close
Set db = Nothing
End Sub
Semoga bisa membantu dan memberi semangat...
Hariyanto (Surabaya)
From: CGSATU <cgsatu@yahoo.com>
To: "belajar-access@yahoogroups.com" <belajar-access@yahoogroups.com>
Sent: Thursday, 5 September 2013, 8:30
Subject: [belajar-access] DDL
Kalau pengalaman saya begini. Setelah create tabel, tabel tersebut saya edit via VBA dengan cara:
Call GAE (nama_tabel, nama_field_checkbox, nama_field_date)
Script GAE itu dibawah ini:
Private Sub GAE(tb As String, field1 As String, field2 As String)
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim db As Database
Dim strSql As String
Dim prp As DAO.Property
Set db = CurrentDb
'It is now in the table collection, so ...
Set tdf = db.TableDefs(tb)
'Change the way the YesNo fields display.
'A Checkbox
Set fld = tdf.Fields(field1)
Set prp = fld.CreateProperty("DisplayControl", dbInteger, acCheckBox)
fld.Properties.Append prp
Set fld = tdf.Fields(field1)
Set prp = fld.CreateProperty("Format", dbText, "Yes/No")
fld.Properties.Append prp
Set fld = tdf.Fields(field2)
Set prp = fld.CreateProperty("Format", dbText, "Long Date")
fld.Properties.Append prp
db.Close
Set db = Nothing
End Sub
Semoga bisa membantu dan memberi semangat...
Hariyanto (Surabaya)
From: CGSATU <cgsatu@yahoo.com>
To: "belajar-access@yahoogroups.com" <belajar-access@yahoogroups.com>
Sent: Thursday, 5 September 2013, 8:30
Subject: [belajar-access] DDL
Sorry, mau tanya, ada yang tahu tidak ya....
misal saya buat tabel dengan DDL sbb :
CREATE TABLE Pegawai
([PegawaiID] COUNTER,
[Namadepan] TEXT(12),
[Namatengah] TEXT(10),
[Namabelakang] TEXT(12),
[TglLahir] DATE,
[Telepon] TEXT(14),
[Kelamin] YESNO,
[Catatan] memo,
[Gaji] Currency,
CONSTRAINT [Index1] PRIMARY KEY ([TemanID]));
[Namadepan] TEXT(12),
[Namatengah] TEXT(10),
[Namabelakang] TEXT(12),
[TglLahir] DATE,
[Telepon] TEXT(14),
[Kelamin] YESNO,
[Catatan] memo,
[Gaji] Currency,
CONSTRAINT [Index1] PRIMARY KEY ([TemanID]));
Nah, khusus untuk field Kelamin, itu kan boolean. Nah bagaimana agar property Display Control-nya menjadi Check Box. By default itu cuma TextBox.
Terus untuk yang kolom TglLahir kan Date, supaya bisa langsung jadi Long Date parameternya apa ya ?
Makasih :)
cgsatu (Elang)
__._,_.___
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (3) |
SPAM IS PROHIBITED
.
__,_._,___
Tidak ada komentar:
Posting Komentar