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:
Private Sub FrameViewMode_AfterUpdate() If Me.FrameViewMode = 2 Then Me.GroupName.Enabled = True Me.FromAccountCode.Enabled = True Me.ToAccountCode.Enabled = True Me.FromAccountName.Enabled = True Me.ToAccountName.Enabled = True Me.Form.Requery Else Me.GroupName.Enabled = False Me.FromAccountCode.Enabled = False Me.ToAccountCode.Enabled = False Me.FromAccountName.Enabled = False Me.ToAccountName.Enabled = False End If 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:
Private Sub GroupName_AfterUpdate() Me.FromAccountCode.Requery End Sub
- On Change = [Event Procedure] and type this procedure:
Private Sub GroupName_Change() Me.FromAccountCode = Null Me.ToAccountCode = Null 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:
Private Sub FromAccountCode_AfterUpdate() Me.ToAccountCode.Requery 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:
Private Sub Command1_Click() If Me.FrameViewMode = 2 Then If IsNull(Me.FromAccountCode) Or IsNull(Me.ToAccountCode) Then MsgBox "Either From Code or To Code is empty", vbExclamation, "Empty Field" Exit Sub End If End If Global_PreviewUnRefresh ("rptMainAccount") 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