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

Nested If statements

Status
Not open for further replies.

mflower

MIS
May 6, 2001
52
0
0
NZ
Anyone knows where I can get more information about nested If statements? The problem I have with mine is it stops at the first If statement and does not proceed to the next.
 
Hi, I've changed it to a Select Case statement:

Select Case ([Sent]) And ([Recvd])
'document sent, not returned
Case Not IsNull([Sent]) And IsNull([Recvd])
Me!imgDocNotReturned.Visible = True
Me!imgDocReturned.Visible = False

'document sent, document returned
Case Not IsNull([Recvd]) And Not IsNull([Sent])
Me!imgDocNotReturned.Visible = False
Me!imgDocReturned.Visible = False

'survey not sent, survey not returned
Case IsNull([Recvd]) And IsNull([Sent])
Me!imgDocNotReturned.Visible = False
Me!imgDocReturned.Visible = False

Case Else

End Select

It keeps stopping in the first case and won't loop to the next for all the recordset. What code shall I add in to loop through instead of stopping at the first case? Thanks in advance.
 
I have an idea for an approach but how are [Recvd] and [Sent] derived and what are the datatypes?
 
Yes, a little more detail would help. You should be able to use If statements if you want.
 
I think nested IFs (Even If.. ElseIf...ElseIF) is the way to go. I had an instructor that went psycho whenever he saw CASE statements with more than 1 variable and double negatives (Not IsNull) although I agree there is often no way around it. The If..Then, ElseIF...Then will probably read a little cleaner too...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top