
Signature
Dave Hargis, Microsoft Access MVP
Hi Klatuu
I guess that's a mix of what you've said, but it's what i would like to, in
theory, one of the fields to do, VALUEPREP. This field, before anything,
gotta check if a field called [Comis] is true or false. In case it's false,
value 0, but if not, have to check another field, [Valvend], and there are
only 5 or 6 possibilities (Between 0 and 30, between 31 and 50 ...) . If
first, then 5, if 2nd, then 10 and so on.
Hope i was clear enough for you. Please help me but don't forget to do it
like i'm 10 years old.
Tks in advance
Pedro
> Where are you trying to use this code? It looks like a mixture of VBA and
> SQL, but not exacly either.
[quoted text clipped - 21 lines]
> > Tks in advance
> > Pedro
Klatuu - 18 May 2007 14:22 GMT
I understand, but where will this code be? In a procedure (sub or function),
an SQL query?
When you say "field", do you mean a field in a recordset/table, or controls
on a form?

Signature
Dave Hargis, Microsoft Access MVP
> Hi Klatuu
> I guess that's a mix of what you've said, but it's what i would like to, in
[quoted text clipped - 33 lines]
> > > Tks in advance
> > > Pedro
Pedro - 22 May 2007 17:25 GMT
Sorry for the delay ... i meant for a field on a form
> I understand, but where will this code be? In a procedure (sub or function),
> an SQL query?
[quoted text clipped - 38 lines]
> > > > Tks in advance
> > > > Pedro
Klatuu - 22 May 2007 17:35 GMT
Well, Pedro, terminology is a bit mixed here. Although you will see it
incorrectly used even by Microsoft, forms do not have fields, they have
controls. Fields are properties of tables or queries.
In any case, the best way to do this is with a Select Case statment.
If Not Me.Comis Then
Me.VALUEPREP = 0
ELSE
Select Case Me.VALVEND
Case 0 to 30
Me.VALUEPREP = 5€
Case 31 to 50
Me.VALUEPREP = 10€
Case 51 to 90
Me.VALUEPREP = 15€
'And So On
Case Else
MsgBox "No Valid Number"
End Select
ENDIF
Where the code will go I can't tell you because you did not provide enough
information.

Signature
Dave Hargis, Microsoft Access MVP
> Sorry for the delay ... i meant for a field on a form
>
[quoted text clipped - 40 lines]
> > > > > Tks in advance
> > > > > Pedro