If then statement

N

neenmarie

Can someone help me with an if then statement?
I'd like to acheive the following:

If([list86] is null, [list93].setfocus, [list86].setfocus)
 
A

Al Williams

Neenmarie,

IIF(IsNull([list86]),[list93].setfocus,[list86].setfocus)

HTH

Al
Can someone help me with an if then statement?
I'd like to acheive the following:

If([list86] is null, [list93].setfocus, [list86].setfocus)
 
H

HC

i would chance it to this.

IIf([list86] > "",[list86].setfocus, [list93].setfocus)

Hope it helps.
 
R

Rick B

Where are you doinmg this?

This needs to be in code.

I think you'd do something more like...

if IsNull([list86]) then
me.list93.setfocus
else
me.list86.setfocus
end if
 
D

Dan

If you're trying to make sure that something is entered in list86 before
moving on to list93 then I would
put IS NOT NULL in the validation rule for list86. You could also add
validation text to tell them that
data is required.

The way that you've written this, they can't leave list86 until it is null.
If you really want it in code then it would probably go in the before update
event and look like this:

Private Sub list86_BeforeUpdate(Cancel As Integer)

If IsNull(Me!list86) Then
MsgBox "Field cannot be empty"
Me!list86.SetFocus 'not sure if you need this line, Cancel=True may
leave you in list86
Cancel = True
Else
Me!list93.SetFocus
End If

End Sub



Rick B said:
Where are you doinmg this?

This needs to be in code.

I think you'd do something more like...

if IsNull([list86]) then
me.list93.setfocus
else
me.list86.setfocus
end if



--
Rick B



neenmarie said:
Can someone help me with an if then statement?
I'd like to acheive the following:

If([list86] is null, [list93].setfocus, [list86].setfocus)
 
N

neenmarie

Thank you all for your input. I have it working now.
For your info if you are just curious....
These list boxes are on one form used to receive shipments.
List77 is a listing of open POs to outside processors and raw material
suppliers. When the user selects the company they are receiving goods from,
it re-queries List77 to show only POs to that vendor. When a PO is selected
from List77, it requires List86 and List93 to show only shippers and/or
releases against Purchase Orders related to that PO.

List86 is a listing of Shipments to Outside Processosrs that need to be
completed and returned. The user would click on the out-going shipper # that
they want to receive returned material against. This then reduces the
quantity at the outside processor until it reaches zero and then that shipper
no longer appears.

List93 is a list box of Open Releases against Purchase Orders for Raw
Material. The user clicks on it to select the release they are receiving raw
material against. This then reduces the quantiy due until that realease hits
zero and it no longer appears on the listing.

I was trying to set focus to one or the other list box because the user was
having to click several times to get the data to fill-in onto the form. The
first click was to get the focus to the list box....then the second or third
would fill-in the data.

So now, if List86 is empty because the PO selected was for raw material not
out sourced operations, the focus will go to List93 and visa versa.

Thank you again for all your help. It is working now.

neenmarie said:
Pls disregard....has been answered
Thank you

neenmarie said:
Can someone help me with an if then statement?
I'd like to acheive the following:

If([list86] is null, [list93].setfocus, [list86].setfocus)
 
Top