Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fiscal Calender View - CS0002 2

Status
Not open for further replies.

Simboti1

IS-IT--Management
Sep 12, 2008
31
BW
May someone please Help.

I have covered 95% of my conversion project from pure VB6 to VB6 plus XAPI for ACCPAC 5.4A and 5.5A. I am able to use access the GL0001 view through the following code:
------------------------------------------------------------
Public ACCPAC_Session As AccpacSession
Dim Fnd As AccpacFinder.ViewFinder
Set Fnd = New AccpacFinder.ViewFinder
Fnd.Session = ACCPAC_Session

Fnd.ViewID = "GL0001"
Fnd.DisplayFieldIDs = Array(21, 1, 3)
Fnd.ReturnFieldIDs = Array(21, 1, 3)
Fnd.Filter = ""
Fnd.InitKeyType = KEY_VALUE_AS_INIT_KEY
Fnd.InitKeyValue = txtGL_ACCOUNT.Text

Fnd.AutoTabAway = True

If Fnd.Finder = True Then
txtGL_ACCOUNT.Text = " " & Fnd.ReturnFieldValues(1)
txtGL_Account_Name.Text = " " & Fnd.ReturnFieldValues(2)
End If
------------------------------------------------------------

My problem is in making use of the CS0002 view in VB6-XAPI environment. I would like to drop down the Calender control from a VB form and trap the YEAR and PERIOD
 
Don't use the CS0002 view, that is too messy.
If you want to pass a date and have the year/period returned then look at AccpacFiscalCalendar.GetPeriod
 
Hi Ettienne

Thanks very much. Is it possible for you to assist with the sample code for the AccpacFiscalCalendar.GetPeriod route?

Regards

Simboti
 
Add this to a command button.
Code:
Dim intPeriod As Integer
Dim strYear As String

Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim Calendar As AccpacCOMAPI.AccpacFiscalCalendar

Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
Set Calendar = mDBLinkCmpRW.GetFiscalCalendar

If Calendar.GetPeriod(Now, intPeriod, strYear) Then
    MsgBox strYear & " - " & intPeriod
End If

Set Calendar = Nothing
Set mDBLinkCmpRW = Nothing
 
Hi ettienne

Your code is running fine. However, my requirements are slightly different. Here I go: -
1. I have referenced ACCPAC's Periodpicker on a form. I have named it pckACCPER.
2. When I click on the pckACCPER control, I need to select an accounting Period (Similar to what happens when one clicks the period finder in ACCPAC to select a accounting period for a report etc)
3. I then want to use the selected accounting period (Year and Month for latter processing.

I hope this clarifies my requirements.

Regards

Simboti
 
I don't use the PeriodPicker because it is a bound control, and you need to bind it to a data source. My preferred method is to work without bound controls, so I use a combo box for both the Year and Period where I need them and populate these on Form_Initialize. It is simple to get the FirstYear and LastYear from the AccpacFiscalCalender as well as the number of periods. Getting the current year & period is also easy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top