Creating such above report involve a wide range of MS Access objects: table, query, form, report, and module. To make such a report, follow these long steps.
- Using Blank Form, create a form described below:
- Following are the related properties:
- Form properties:
- Caption = Preview Report of Chart of Account - Main Account
- Modal = Yes
- Auto Center = Yes
- Auto Resize = Yes
- Fit to Screen = Yes
- Moveable = No
- Border Style = Dialog
- Record Selector = No
- Navigation Button= No
- Using Use Control Wizards in Controls Group, click Option Group button
(available in Control group as well) and enter:
- Labels names:
- View All
- View by Range:
- Set View All as the default. Click next to continue.
- Set Value for View All is 1 and View By Range: is 2. Click next to continue.
- Click next to continue.
- Caption = View Mode and click Finish.
- Labels names:
- Go to frame properties and set the following:
- Name = FrameViewMode
- Border Style = Transparent
- After Update = [Event Procedure] and type this procedure:
01
Private
Sub
FrameViewMode_AfterUpdate()
02
If
Me
.FrameViewMode = 2
Then
03
Me
.GroupName.Enabled =
True
04
Me
.FromAccountCode.Enabled =
True
05
Me
.ToAccountCode.Enabled =
True
06
Me
.FromAccountName.Enabled =
True
07
Me
.ToAccountName.Enabled =
True
08
Me
.Form.Requery
09
Else
10
Me
.GroupName.Enabled =
False
11
Me
.FromAccountCode.Enabled =
False
12
Me
.ToAccountCode.Enabled =
False
13
Me
.FromAccountName.Enabled =
False
14
Me
.ToAccountName.Enabled =
False
15
End
If
16
End
Sub
- On the Tools tab, click Add Existing Fields to change the Task Pane to Field List, choose table tblMainAccount
- Drag field GroupName on to the form.
- Change the Task Pane back to Properties Sheet
- Click GroupName combo box and set the following properties:
- Control Source = blank
- Enabled = No
- After Update = [Event Procedure] and type this procedure:
1
Private
Sub
GroupName_AfterUpdate()
2
Me
.FromAccountCode.Requery
3
End
Sub
- On Change = [Event Procedure] and type this procedure:
1
Private
Sub
GroupName_Change()
2
Me
.FromAccountCode = Null
3
Me
.ToAccountCode = Null
4
End
Sub
- Create a combo box and set the properties as follow:
- Name = FromAccountCode
- Row Source = SELECT tblMainAccount.AccountCode, tblMainAccount.AccountName FROM tblMainAccount WHERE (((tblMainAccount.GroupName)=[Forms]![frmMainAccountDialog]![GroupName])) ORDER BY tblMainAccount.AccountCode;
- Row Source Type = Table/Query
- Bound Column = 1
- Column Count = 2
- Column Widths = 1";2"
- List Width = 3
- Limit to list = Yes
- Enabled = No
- After Update = [Event Procedure] and type this procedure:
1
Private
Sub
FromAccountCode_AfterUpdate()
2
Me
.ToAccountCode.Requery
3
End
Sub
- Create same combo box above and set the properties as follow:
- Name = ToAccountCode
- Row Source = SELECT tblMainAccount.AccountCode,
tblMainAccount.AccountName
FROM tblMainAccount WHERE (((tblMainAccount.AccountCode)>=[Forms]![frmMainAccountDialog]![FromAccountCode]) AND ((tblMainAccount.GroupName)=[Forms]![frmMainAccountDialog]![GroupName])) ORDER BY tblMainAccount.AccountCode; - Row Source Type = Table/Query
- Bound Column = 1
- Column Count = 2
- Column Widths = 1";2"
- List Width = 3
- Limit to list = Yes
- Enabled = No
- Create a text box and set the properties as follow:
- Name = FromAccountName
- Control Source = =[FromAccountCode].[column](1)
- Enabled = No
- Width = 2.7083"
- Create same text box above and set the properties as follow:
- Name = FromAccountName
- Control Source = =[FromAccountCode].[column](1)
- Enabled = No
- Width = 2.7083"
- Disable Use Control Wizards and create Button (Form Control), set the
properties as follow:
- Name = Command1
- Caption = View Report
- Width = 1"
- On Click = [Event Procedure] and type this procedure:
01
Private
Sub
Command1_Click()
02
If
Me
.FrameViewMode = 2
Then
03
If
IsNull(
Me
.FromAccountCode)
Or
04
IsNull(
Me
.ToAccountCode)
Then
05
MsgBox
06
"Either From Code or To Code is empty"
, vbExclamation,
"Empty Field"
07
Exit
Sub
08
End
If
09
End
If
10
Global_PreviewUnRefresh (
"rptMainAccount"
)
11
End
Sub
- Create same button (Form Control) above and set the properties as
follow:
- Name = Command0
- Caption = Cancel
- Width = 1"
- On Click = =Global_Close()
- Finally, go to Form properties and set the Record Source to blank.
- Form properties:
- Save form as frmMainAccountDialog and close it.
- Open form frmMainAccount as in the picture below in design view.
- On the most right side of
, add another button like this
and set the properties as follows:
- Name = Preview
- Caption = Preview
- Picture = (image), image name = Preview
- Width = 0.3333"
- On Click = =Global_OpenForm('frmMainAccountDialog')
- Save and close frmMainAccount. The form is ready for used.
WoW,masalah ginian saya ketinggalan jauh nih,perlu belajar banyak... :P
ReplyDeletehay plzzzzzzzzz send this this application in
ReplyDeletenaveed178@HOTMAIL.COM