Can i simplify my codes?
In a lot of forms and reports i have repeatedly used one and the same condition:
Public function example()
Dim strDocName As String
strDocName = “FOrderinformation”
dim office as control
set office = Forms![FOrderInformation![office]
If IsOpen(strDocName) = True Then
if office = 1 then
do something
elseif office = 2 then
do something
elseif office = 3 then
do something
elseif office = 4 then
do something
elseif office = 5 then
do something
elseif office = 6 then
do something
end if
end if
end function
I have diferent RecordSources RowSources,in the different forms and reports, etc depending on the office number i have selected in the main form called FOrderInformation.
I am writing the above code again and again in different functions but i wonder is it possible
to simplify my process and write one global function?I mean to refer to one basic array or function.