Kamis, 31 Mei 2012

Re: [MS_AccessPros] Value of Combo Box

 

you're welcome, Bill ;) happy to help

Warm Regards,
Crystal

 *
   (: have an awesome day :)
 *

________________________________
From: Bill Singer

Crystal,

Thank you.  Null is not a number. I will remember that.

Bill Singer

From: Crystal
 

Hi Bill,

first: NAME the command button something logical before you assign code,
like cmd_OpenQueryName

Null is not a value, it is the absence of a value, so you cannot compare to
it using =

'~~~~~~~~~~~~~~~~~~~~~~~~

  if isNull(me.controlname) then
      me.controlname.setfocus
      MsgBox "Season field must be filled",,"Missing Data"

      'if control is a combo, then drop the list
      me.controlname.dropdown
      EXIT SUB
    end if
  ' more statements

'~~~~~~~~~~~~~~~~~~~~~~~~

Warm Regards,
Crystal

Microsoft MVP, Access
remote training and programming

www.AccessMVP.com/strive4peace

www.YouTube.com/LearnAccessByCrystal
www.YouTube.com/LearnByCrystal

* (:  have an awesome day :) *

________________________________
From: agent1of6 <Bill.Singer@at-group.net
<mailto:Bill.Singer%40at-group.net> >
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> 
Sent: Wednesday, May 30, 2012 8:31 PM
Subject: [MS_AccessPros] Value of Combo Box

I tried writing my first bit of code without help and went down if flames.

I have a form that the user will select a value from a Combo box and then
press a button to view the next form, sorted by the combo box.

As the first part of the code I tried to use...

Private Sub Command12_Click()
    If [cboSeason] = Null Then
        MsgBox "Season field must be filled"
    End If
   
End Sub

The "Null" does not work.  If I put a value in there(If [cboSeason] = 1)
and then set the combo box to that value it works fine.

What is the value of an unfilled combo box?  I figured it would be Null.  An
empty combo box = Null comes up False.

I am trying to eliminate the Access error boxes when a query is run without
the combo boxes being full.

Thanks for your help.
Bill
MN

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar