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

if with case not working

Status
Not open for further replies.

mckenneyj

MIS
Jun 1, 2002
96
Can anyone tell me what is wrong with this statement.
If I comment out the IF stmt then the case works fine.

Private Sub Date_AfterUpdate()
Dim ResultYear As Integer
ResultYear = DatePart("yyyy", Me.Date)

If Me.cmbCycle = Null Then
Select Case ResultYear
Case 2003 To 2005:
Me.cmbCycle = "2003-2005"

Case 2006 To 2008:
Me.cmbCycle = "2006-2008"


Case 2009 To 2011:
Me.cmbCycle = "2009-2011"


Case 2012 To 2014:
Me.cmbCycle = "2012-2014"

Case 2015 To 2017:
Me.cmbCycle = "2015-2017"

Case 2018 To 2020:
Me.cmbCycle = "2018-2020"


End Select
End If
End Sub


Thanks,
John McKenney
Work Hard... Play Harder
 
It's the Null test that isn't working, try for instance:

[tt]If IsNull(Me.cmbCycle) Then ' or
If trim$(Me.cmbCycle & "")="" Then[/tt]

Roy-Vidar
 
If IsNull(Me.cmbCycle)

Works perfect
Thanks

Thanks,
John McKenney
Work Hard... Play Harder
 
or

Code:
[blue]If Len(trim(Me.cmbCycle & "")) = 0 Then [/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top