Hello Everyone~
Does anyone know of a way to update the visibility of a control twice within the same event? Here's what I want to do, I have a form with a command button (cmdGo). On the click event, I want the following sequence of events:
1- a listbox (lstFiles) to become invisible
2- a label (lblStatus) to become visible
3- update the lstfiles row source
4 - make lblStatus invisible
5- make lstFiles visible
My problem is that the visibility of lstFiles and lblStatus is only updating at the end of the cmdGo click event. Is it possible to have them update multiple times?
Here's my code:
Private Sub cmdGo_Click()
Dim strFY As String, strFolder As String
'This changes the visibility of a group of controls with similar tags...it works, trust me.
Call rmMakeVisible(Forms!frmScannedSearch, "status")
Call rmMakeInvisible(Forms!frmScannedSearch, "results")
If IsNull(lstFY.Value) Then
MsgBox "Please select a fiscal year"
Exit Sub
Else
strFY = Right(lstFY.Value, 2)
strFolder = "c:\FY" & strFY & "_PDF\"
End If
'This is the function that populates my listbox...also works.
lstFiles.RowSource = rmPopListBox(strFolder, "pdf")
Call rmMakeInvisible(Forms!frmScannedSearch, "status")
Call rmMakeVisible(Forms!frmScannedSearch, "results")
End Sub
Here's the code for my rmMakeVisible function; the rmMakeInvisible just uses "false" instead of "true"
Function rmMakeVisible(frm As Form, TagName As String)
Dim ctl As Control
For Each ctl In frm.Controls
If ctl.Tag = TagName Then
With ctl
.Visible = True
End With
End If
Next ctl
End Function
Can anyone help me? Is this even possible?
Thanks,
®
Does anyone know of a way to update the visibility of a control twice within the same event? Here's what I want to do, I have a form with a command button (cmdGo). On the click event, I want the following sequence of events:
1- a listbox (lstFiles) to become invisible
2- a label (lblStatus) to become visible
3- update the lstfiles row source
4 - make lblStatus invisible
5- make lstFiles visible
My problem is that the visibility of lstFiles and lblStatus is only updating at the end of the cmdGo click event. Is it possible to have them update multiple times?
Here's my code:
Private Sub cmdGo_Click()
Dim strFY As String, strFolder As String
'This changes the visibility of a group of controls with similar tags...it works, trust me.
Call rmMakeVisible(Forms!frmScannedSearch, "status")
Call rmMakeInvisible(Forms!frmScannedSearch, "results")
If IsNull(lstFY.Value) Then
MsgBox "Please select a fiscal year"
Exit Sub
Else
strFY = Right(lstFY.Value, 2)
strFolder = "c:\FY" & strFY & "_PDF\"
End If
'This is the function that populates my listbox...also works.
lstFiles.RowSource = rmPopListBox(strFolder, "pdf")
Call rmMakeInvisible(Forms!frmScannedSearch, "status")
Call rmMakeVisible(Forms!frmScannedSearch, "results")
End Sub
Here's the code for my rmMakeVisible function; the rmMakeInvisible just uses "false" instead of "true"
Function rmMakeVisible(frm As Form, TagName As String)
Dim ctl As Control
For Each ctl In frm.Controls
If ctl.Tag = TagName Then
With ctl
.Visible = True
End With
End If
Next ctl
End Function
Can anyone help me? Is this even possible?
Thanks,
®