Hi,
I have a form bounded to a query, which returns the date and hospital codes.
In the form, there're 3 controls: StartDate, EndDate (both're textbox whose default values are from query) and a multiselect listbox (contains a hospital code list I manually created, not from the query. The reason is I want to include "ALL" in the list).
The scenario is: some users don't need to select a hospital code at all 'cause they don't have other hospitals' data. So, there's no need to show the multiselect listbox for them to select. I plan to create two more hidden textbox (both have control source value from a query), then compare their values. If they're equal, Show the multiselect listbox; not, make it invisible. My question is how? I tried really hard in my code:
Private Sub Form_Load()
If Me!TxtFirstHosp.Value = Me!TxtFirstHosp.Value Then
DoCmd.MoveSize , , , 3090
Else
DoCmd.MoveSize , , , 3990
Me!ListHosp.SetFocus
End If
End Sub
Something wrong with my code??? Please help. Many many thankyous in advance
I have a form bounded to a query, which returns the date and hospital codes.
In the form, there're 3 controls: StartDate, EndDate (both're textbox whose default values are from query) and a multiselect listbox (contains a hospital code list I manually created, not from the query. The reason is I want to include "ALL" in the list).
The scenario is: some users don't need to select a hospital code at all 'cause they don't have other hospitals' data. So, there's no need to show the multiselect listbox for them to select. I plan to create two more hidden textbox (both have control source value from a query), then compare their values. If they're equal, Show the multiselect listbox; not, make it invisible. My question is how? I tried really hard in my code:
Private Sub Form_Load()
If Me!TxtFirstHosp.Value = Me!TxtFirstHosp.Value Then
DoCmd.MoveSize , , , 3090
Else
DoCmd.MoveSize , , , 3990
Me!ListHosp.SetFocus
End If
End Sub
Something wrong with my code??? Please help. Many many thankyous in advance