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!

IN

Status
Not open for further replies.

brbarto

Technical User
Sep 6, 2001
34
0
0
Can I use IN in an if statement? If so, how?? How would be the best way to do the following?

If Me!VehicleNumber.Column(5) IN("820", "822", "824") And
[EndMileage] - [BeginMileage] < 1000 Then
Form!fsubPerMileCharge.Form![Quantity] = 1000
Else
Form!fsubPerMileCharge.Form![Quantity] =
[EndMileage] - [BeginMileage]
End If

Thanks (new to Access)
 
Instead of using the IN operator use the OR operator.

If Me!VehicleNumber.Column(5)= &quot;820&quot; OR &quot;822&quot; OR &quot;824&quot; ...

Usually it is better to lookup the data in a table then typing it in into a funciton, but depends on the situation you have.

ElGuapo

 
&quot;In&quot; is an SQL reserved word and NOT a VB function. MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top