Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Is it null or not

Status
Not open for further replies.

3587ch

Technical User
Jun 19, 2009
30
US
If I make a selection from a combo box and then in code set it to = "", and then test for Not IsNull() on that combo box will it be null?

Or should I be checking some other way, other than isnull()?

Dim X As Integer
For X = 2 To 6
Me("cbotbl" & (X)).Visible = False
Me("cbotbl" & (X)) = ""
Next X

'Now if I check for Not IsNull with it be null or not?
If Not IsNull(Me.cbotbl2) And Not IsNull(Me.cbotbl3) And Not IsNull(Me.cbotbl4) And Not IsNull(Me.cbotbl5) And Not IsNull(Me.cbotbl6) Then
strSQL = strSQL & " FROM ((((" & Me.cbotbl1.Column(0)
 
No. "" is not a null character. If you want to set the value to null, the do this: Me("cbotbl"& (X)) = null. VB understands the word null as representing a null character.

By the way, I have not checked the correctness of your statement. I am just using it as an example.

 
How are ya 3587ch . . .

[blue]""[/blue] in a [blue]Null String[/blue] ... not a [blue]Null[/blue] value! To test:
Code:
[blue] If ... <> "" Then[/blue]
[blue]Your Thoughts? . . .[/blue]

BTW: Welcome to [blue]Tek-Tips![/blue] [thumbsup2] Do have a look at one of the links at the bottom of my post. The links will help you [blue]ask better questions[/blue], get [blue]quick responses[/blue], [blue]better answers[/blue], and insite into [blue]etiquette[/blue] here in the forums. Again . . . Welcome to [blue]Tek-Tips![/blue] [thumbsup2] [blue]Its Worthy Reading![/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Replace this:
If Not IsNull(Me.cbotbl2)
to this:
If Trim(Me.cbotbl2 & "") <> ""

This tests for Null, ZeroLength or Spaces.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top