Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2006

Tip: Looking for answers? Try searching our database.

Change public function value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Angel - 27 Apr 2006 18:13 GMT
Hi!
I have a public Function stored in a module "MyDates" that stores the fiscal
year, which is used in several forms and reports.

Public Function FisYear() As String
FisYear = DLookup("[FiscalPeriod]", "Dbo_AMC_Info", "[ID] = 1")
End Function

I want to be able to modify the value from a form's "FiscalYear" dropdown
box  but do not know how to change the value of a public function from a
private sub on change
The dropdown box pulls all available fiscal years from a table.

SELECT DISTINCT SH_PSUM.BUS_YEAR
FROM SH_PSUM;

Can I pass the selected value to the public function?
Here is what I need:

Private Sub FiscalYear_Change()
???????
End Function

Thanks in adavance!
Marshall Barton - 27 Apr 2006 18:51 GMT
>Hi!
>I have a public Function stored in a module "MyDates" that stores the fiscal
[quoted text clipped - 18 lines]
>???????
>End Function

Functions should be controlled through one or more
arguments.  I'm not sure what you want, but maybe something
like:

Public Function FisYear(YearID As Integer) As String
    FisYear = DLookup("[FiscalPeriod]", "Dbo_AMC_Info", _
                                                            "[ID] = "  & YearID)
End Function

Then you will get the same result as before by using:
    strYear = FisYear(1)

or if the combo box value is an integer for the desired
year:
    strYear = FisYear(Me.FiscalYear)

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.