Randomblink
The Irreverent Reverend
- Local time
- Yesterday, 23:32
- Joined
- Jul 23, 2001
- Messages
- 279
I have a function stored in a module.
I want to be able to run this function from several forms...
Each form will have a listbox that is named lst_SearchWindow.
Each form will have two labels named: btn_Delete and btn_CancelDelete.
What I want to do is affect these objects.
But everytime I try to reference these forms from a Function, I have to verify which form in the Public Function which does me no good...
I want to write code like this:
Public Function ButtonCheck(Slctn As String, Trgt as Control)
Select Case Slctn
Case "Delete"
Trgt.SetFocus
Call BttnAct("Show", "Hide")
Case "Search"
Call BttnAct("Hide", "Show")
Case "Blank"
Trgt.SetFocus
Call BttnAct("Hide", "Hide")
End Select
End Function
Public Function BttnAct(Dlt As String, Srch As String)
Select Case Dlt
Case "Hide"
BttnVs ("False")
Case "Show"
BttnVs ("True")
End Select
Select Case Srch
Case "Hide"
Call SrchWndwVs("False", lst_SearchWindow.Width)
Case "Show"
Call SrchWndwVs("True", lst_SearchWindow.Width)
End Select
End Function
Public Function BttnVs(DltLgc As String)
btn_Delete.Visible = DltLgc
btn_CancelDelete.Visible = DltLgc
End Function
Public Function SrchWndwVs(SrchLgc As String, Wdth As Integer)
Wdth = Wdth * 1440
lst_SearchWindow.Visible = SrchLgc
Select Case SrchLgc
Case "True"
lst_SearchWindow.Width = Wdth
Case "False"
lst_SearchWindow.Width = 0
End Select
End Function
Then, from ANY form I can Call the ButtonCheck Function, and it will activate the buttons and search window correctly.
But it doesn't work...
lst_SearchWindow.Tag = 3.5
I have it set up so that as a user presses the Search button, it closes the Delete buttons and Vice Versa. I want to use this code to use a simple search and delete button set up on all my forms...
What am I doing wrong...?
Argh!
When I click on the button to search or delete...
The Search Window button has this code in it:
Call ButtonCheck("Search", "Me!Dept_ID")
I get this message...
The expression On Click you entered as the event property setting produced the following error: Type mismatch
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event, or macro.
What am I doing wrong...?
Help!
I want to be able to run this function from several forms...
Each form will have a listbox that is named lst_SearchWindow.
Each form will have two labels named: btn_Delete and btn_CancelDelete.
What I want to do is affect these objects.
But everytime I try to reference these forms from a Function, I have to verify which form in the Public Function which does me no good...
I want to write code like this:
Public Function ButtonCheck(Slctn As String, Trgt as Control)
Select Case Slctn
Case "Delete"
Trgt.SetFocus
Call BttnAct("Show", "Hide")
Case "Search"
Call BttnAct("Hide", "Show")
Case "Blank"
Trgt.SetFocus
Call BttnAct("Hide", "Hide")
End Select
End Function
Public Function BttnAct(Dlt As String, Srch As String)
Select Case Dlt
Case "Hide"
BttnVs ("False")
Case "Show"
BttnVs ("True")
End Select
Select Case Srch
Case "Hide"
Call SrchWndwVs("False", lst_SearchWindow.Width)
Case "Show"
Call SrchWndwVs("True", lst_SearchWindow.Width)
End Select
End Function
Public Function BttnVs(DltLgc As String)
btn_Delete.Visible = DltLgc
btn_CancelDelete.Visible = DltLgc
End Function
Public Function SrchWndwVs(SrchLgc As String, Wdth As Integer)
Wdth = Wdth * 1440
lst_SearchWindow.Visible = SrchLgc
Select Case SrchLgc
Case "True"
lst_SearchWindow.Width = Wdth
Case "False"
lst_SearchWindow.Width = 0
End Select
End Function
Then, from ANY form I can Call the ButtonCheck Function, and it will activate the buttons and search window correctly.
But it doesn't work...
lst_SearchWindow.Tag = 3.5
I have it set up so that as a user presses the Search button, it closes the Delete buttons and Vice Versa. I want to use this code to use a simple search and delete button set up on all my forms...
What am I doing wrong...?
Argh!
When I click on the button to search or delete...
The Search Window button has this code in it:
Call ButtonCheck("Search", "Me!Dept_ID")
I get this message...
The expression On Click you entered as the event property setting produced the following error: Type mismatch
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event, or macro.
What am I doing wrong...?
Help!