If statment and between range in the form text control

  • Thread starter Thread starter vsteshenko
  • Start date Start date
V

vsteshenko

Hello,

This is my first post so I hope I'm doing this correctly. I am
currently working on creating an order form for sales associates at my
work to be used at conventions. I have a form with a subform. On the
main form, there is a text box that displays the sum of total orders
entered in the subform, [SUBTOTAL]. I'm trying to create another text
box on the main form, [GIFTS] that looks at the subtotal text box and
depending on the value, displays one out of three options.

I have set the control source of the Gifts text box to be the same as
in the Subtotal text box. I have entered the following code in the
even after update of the GIFTS tex box.

Private Sub Gifts_AfterUpdate()
If [Subtotal] >= 0 And [Subtotal] <= 2499 Then
Me.gifts = 0
ElseIf [Subtotal] >= 2500 And [Subtotal] <= 4999 Then
Me.gifts = 250
ElseIf [Subtotal] >= 5000 Then
Me.gifts = 600
End If

End Sub

Can somebody please help me with this, I have looked at allot of
messages and most of them deal with dates.
 
This is my first post so I hope I'm doing this correctly.

Nope, here's why:

1) This is not the MS Access newsgroup you need to post this there
(http://groups.google.com/group/comp.databases.ms-access/topics?
lnk=srg&hl=en)
2) You have the wrong version of Visual Basic. This newsgroup is for
Visual Basic .Net, which is almost completely incompatible with visual
basic for applications (what Access uses).

Since you're a newbie to newsgroups, I excuse the mispost and give you
some suggestions (outside of reposting to the correct newsgroup)

1) You need to refer to the .Value property of the textbox not the
textbox itself. i.e. Use SUBTOTAL.Value in the comparisons, not
[SUBTOTAL].
2) A Select Case structure might better suit your needs here, look it
up in the documentation for samples.

If this doesn't solve your problems, please post further questions to
the Access newsgroup and not here.

Thanks,

Seth Rowe
 
This is my first post so I hope I'm doing this correctly.

Nope, here's why:

1) This is not the MS Access newsgroup you need to post this there
(http://groups.google.com/group/comp.databases.ms-access/topics?
lnk=srg&hl=en)
2) You have the wrong version of Visual Basic. This newsgroup is for
Visual Basic .Net, which is almost completely incompatible with visual
basic for applications (what Access uses).

Since you're a newbie to newsgroups, I excuse the mispost and give you
some suggestions (outside of reposting to the correct newsgroup)

1) You need to refer to the .Value property of the textbox not the
textbox itself. i.e. Use SUBTOTAL.Value in the comparisons, not
[SUBTOTAL].
2) A Select Case structure might better suit your needs here, look it
up in the documentation for samples.

If this doesn't solve your problems, please post further questions to
the Access newsgroup and not here.

Thanks,

Seth Rowe

This is my first post so I hope I'm doing this correctly. I am
currently working on creating an order form for sales associates at my
work to be used at conventions. I have a form with a subform. On the
main form, there is a text box that displays the sum of total orders
entered in the subform, [SUBTOTAL]. I'm trying to create another text
box on the main form, [GIFTS] that looks at the subtotal text box and
depending on the value, displays one out of three options.
I have set the control source of the Gifts text box to be the same as
in the Subtotal text box. I have entered the following code in the
even after update of the GIFTS tex box.
Private Sub Gifts_AfterUpdate()
If [Subtotal] >= 0 And [Subtotal] <= 2499 Then
Me.gifts = 0
ElseIf [Subtotal] >= 2500 And [Subtotal] <= 4999 Then
Me.gifts = 250
ElseIf [Subtotal] >= 5000 Then
Me.gifts = 600
End If
Can somebody please help me with this, I have looked at allot of
messages and most of them deal with dates.- Hide quoted text -

- Show quoted text -

Thank you Seth for responding to me regardless my error. I have
posted the message again in the usergroup you sugested as the value
suggestion didn't work. It steel gives me the total that is in the
control source.

Thank you,

Victoria
 
Back
Top