Hiding Combo box on form

Chosin01

New member
Local time
Today, 08:14
Joined
Jun 23, 2001
Messages
5
I have a form that I use to collect data. I open the form with a command button Which opens the form to a new record.
I also want to use the same form for a search. I have placed a combo box in the report header. I will use another command button to open the form in data edit mode. The problem is if the combox box is visible in the add mode and the user clicks it they will get an error code. So to avoid that I want to hide the combox when it opened in the add mode. Thanks for the assistance
 
How about this.
Not sure what event you would want to assign this too but I use this to hide a combo box.
[The name of your combo box].visible = False and change to true when you're ready to use it again.
It can't be that simple but maybe you can use it anyway.
Hope it helps.

DJ
 
Thanks DJ. I'm a newbee. I'm aware of the Mycombobox.visible = false or true. And I've used that to hide a combo box before. Like you stated the problem is where it would be attached to, and the conditional statement if any, that it needs. Appreciate you help though. Thanks
 
Try putting the code on the forms on open event. The combo will be hidden when the form opens. Of course you will then have to find a way to make the combo visible. I would suggest and after update event for a manditory text box.
 
thanks but wouldnt that be reversing the problem with still no solution??
 
Here is the solution I worked out.
It might be alittle sloppy since I dont know VB but here it is.

Private Sub Form_Current()
If IsNull(Me("Last Name")) Then
Combo234.Visible = False
Exit Sub
Else
Combo234.Visible = True
Exit Sub
End If
End Sub


This allows the same form to be used in add mode and search mode.

Thanks for everyones assistance.
 
Just a thought but why not make it visible on the push of the command button? If you have two buttons to open the form, one to search, and one to add records then make set the combobox's visible property to false. Then in the add records command button Click event, right after you open the form make the combo box visible.

Forms!FormName.ComboboxName.visible = true

This way, when you open it up for search, the combobox will be invisible, and when you open it to add, it will be visible. Hope this helps.

Doug
 

Users who are viewing this thread

Back
Top Bottom