Trying to open form with onclick event of a combobox on a sub-form

I am trying to open form with an onclick event of a combobox on a sub-form IF the combo-box has a value in it.

I've tried these two things but neither of them will open the form if a value is in the combo-box I am clicking on: (Note:  The value in the combobox is text).

Private Sub cboPart_No_Click()
    If Me.cboPART_NO <> "" Then
        DoCmd.OpenForm "frmPOpricing"
    End If
End Sub


Private Sub cboPart_No_Click()
    If Not IsNull(Me.cboPART_NO) Then
        DoCmd.OpenForm "frmPOpricing"
    End If
End Sub
SteveL13Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
The On Click event of a ComboBox only fires when you open the drop-down and select (click) a item.

From your description: Maybe you should think about using the On Mouse Up event.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
That wont work,
Keep your life simple,...just put a small button by the combobox and open the form with that same code.
This way you can *alert* the user of why it did not work.
If Not IsNull(me.combo) then
    msgbox "You must select a name."
    me.combo.setfocus
    ms.combo.dropdown
    exit sub
else
    docmd.open form "YourForm"
end if
If you absolutely "Must" do something like this, ...do it on the "Double-Click" Event.

Clicking a combobox, and having something happen  is not good UI design,
1. The click event of a combobox is rarely used.
2. Unless this is consistent for ALL comboboxes
3. User understand what will happen on all events of all controls.

For example, ...many user will "click" a control just for the sake of clicking it, .Just to set the focus to it.
In other words, ...user do not commonly expect anything to "Happen" when they click a combobox.

Imagine opening an app, ... and clicking a combobox opens a form
Setting focus to a control, ...opens a report
Hovering over a control, ...opens a query,
...doubleclicking an image, opens a new database...
Too much confusion over what happens when and under what circumstances

I just dislike putting code on "odd" events, ...because users never know what to expect.

Just my 2c...

JeffCoachman
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.