473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

If statment and between range in the form text control

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.

Feb 28 '07 #1
2 1482
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....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
On Feb 28, 1:50 pm, vsteshe...@dentsply.com wrote:
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.

Feb 28 '07 #2
On Feb 28, 2:54 pm, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
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....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

On Feb 28, 1:50 pm, vsteshe...@dentsply.com wrote:
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.- 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

Mar 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
2
by: Alan T | last post by:
I have two bookmarks, eg. beginMark and endMark I need to get the text between these 2 bookmarks, how do I do that? eg. <beginMark> Hello Word! This is Saturday.
5
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used...
1
by: David | last post by:
Hi, I have a table called 'jobserial' This contains amongst others, 2 fields called 'PSL_F_Serial' & 'PSL_L_Serial' Both of these are 'Text' fields (VarChar) which at present hold serial...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.