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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form as constant

Status
Not open for further replies.

OraMs

Programmer
Feb 12, 2000
40
0
0
US
Yes, I know an object cannot be a constant. However, I need some way of having a "constant" form.

Here's my scenerio. I call a function from multiple controls and I pass the form and the control name.

The function is declared as follows:
Code:
Function CtrlNavigation(frmName As Form, ctrlName As String)
On Error GoTo ERROR
    
    Select Case ctrlName.NAME
        
        Case "Control1"
                .
                .
        Case "Control2"
                .
                .
        Case "Control3"
                .
                .
        Case "Control4"
                .
                .
        Case Else
                .
                .
    End Select
ERROR:
    MsgBox Err.DESCRIPTION
End Function

I need to use other controls on the form within each case statement.

I do not want to type the form name each time I call the function.

Any suggestions?? Thanks in advance for your time.
 
Hi!

What you probably want to do is use the Screen object. A few of the properties of the screen object which will be useful for you are: ActiveForm, ActiveControl, PreviousControl. From these you can get the name of the form and use the to loop through the controls on the form to get the information you need, or set up a select case based on the form to access the controls you need. Using the screen object you will not need to send the function any information.

hth Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top