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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box with Blanked Out Entry 2

Status
Not open for further replies.

raf

Programmer
Apr 10, 2000
14
US
I have a combo box called Whse created by the lookup wizard for my whseID field in a inventory table.&nbsp;&nbsp;The box displays the whseName, but it bound to the whseID. Limit To List is yes.&nbsp;&nbsp;This is all on a subform<br><br>Here is the problem.&nbsp;&nbsp;If I pick a warehouse and leave the subform everything is fine.&nbsp;&nbsp;If I go back to the combo box and blank out the entry, without choosing another one, my VBA code crashes as follows:<br><br>MsgBox str$(Me!Whse) - invalid use of Null<br>If I comment this out and put in:<br>if Me!whse = NULL .... fails this test<br><br>I.E., the str$ thinks it is NULL, but the if thinks it is not Null.&nbsp;&nbsp;WHAT IS IT??<br><br>I want to say &quot;if this combo box is left empty&quot; ...<br><br>BTW,&nbsp;&nbsp;if I play this trick without ever entering anything into the box, it IS NULL.&nbsp;&nbsp;It's only when I enter something, then blank it out that it becomes a mystery value.<br><br><br><br>
 
I think what's happening here is that as long as you don't choose anything from the combo box a new record does not exist. But as soon as you choose a value from the combo box, Access generates the new record, then when you blank it out the value in the record then becomes null, giving you the problem you describe.<br><br>HTH<br>RDH <p>Ricky Hicks<br><a href=mailto: rdhicks@mindspring.com> rdhicks@mindspring.com</a><br><a href= > </a><br>
 
Your If...Then statement may actually be the problem in this case too. <br>I'm assuming you finished it with the End If, otherwise that would be giving you an error.<br>but you may want to try experimenting with rewriting it to something like<br><b>If whse Is Null Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?????<br>End If</b><br><br>sometimes the &quot;Is Null&quot; and &quot;=Null&quot; are not the same thing.&nbsp;&nbsp;Can something truly equal a Null, or is it just Null?<br><br>play around with it.<br> <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Thanks everyone - <br><br>The IsNull(XXX) does the trick.<br><br>I Like BFamous's comment<br><br>Can something equal NULL or IS IT NULL........<br><br>Obviously the latter.<br><br>--raf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top