473,405 Members | 2,379 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,405 software developers and data experts.

If else decision making

Jay
Can any one help? I am trying to automate my DB with VBA and need help
with the following. I have a subform that shows orders for
advertisements placed. I would like to read the user input to test the
value of two fields. The first has a cbo of ad sizes set as full, 1/2
page etc..The second is a price field as currency
I am trying to do the following:

when cost has been input
read cboAd size option and read txtCost.
If cost is less than or equal to rate card cost for ad size chosen
setfocus to next field
else if price entered is higher than rate card
display message box
set txtcost at rate card price
and setfocus at txtcost field.

I'm having partial success but I can get the programme to recognize
what ad size has been chosen so an error message is displayed
regardless if the cost is over rate set. Can anyone tell me how to do
this correctly? Thanks Jay

Jul 23 '06 #1
1 2533

Jay wrote:
Can any one help? I am trying to automate my DB with VBA and need help
with the following. I have a subform that shows orders for
advertisements placed. I would like to read the user input to test the
value of two fields. The first has a cbo of ad sizes set as full, 1/2
page etc..The second is a price field as currency
I am trying to do the following:

when cost has been input
read cboAd size option and read txtCost.
If cost is less than or equal to rate card cost for ad size chosen
setfocus to next field
else if price entered is higher than rate card
display message box
set txtcost at rate card price
and setfocus at txtcost field.

I'm having partial success but I can get the programme to recognize
what ad size has been chosen so an error message is displayed
regardless if the cost is over rate set. Can anyone tell me how to do
this correctly? Thanks Jay
What if you were to include the cost for the add size in the
controlsource for the combobox cboAd? Then you could just point to
it...

if me.txtCost>me.cboAd.Columns("RateCardCost") Then
msgbox "Cost is wrong..."
me.txtCost=me.cboAd.Columns("RateCardCost")
else
me.ctlNextControl.Setfocus '---whatever the next control is...
end if

or something like that... Basically I'm cheating and hiding hte {size,
cost} pairs in the combobox's controlsource so it's already in the
form. then I don't have to do any PITA lookups.

HTH,

Pieter

Jul 24 '06 #2

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

Similar topics

4
by: Rainer Queck | last post by:
Hello NG, I need some help in making a decision on finding the right way for our future IDE. I hope that this news group a the right place for this desire. The current situation: We are...
14
by: LP | last post by:
Hi, I will be taking on a new project developing a web-based "reporting system". The first requirement I got from BI group is "we just want to look at the data". Basically, there is a huge...
0
by: Himanshu Saxena | last post by:
hi, this is regarding the Problem in Including Crystal Reports Decision while making a setup project. when i make a new setup project to make the setup kit for my c# exe then due to its...
1
by: jcrouse | last post by:
I have a post about two below this that describes a logical decision. I would like to perform this when the app launches and before a form loads then load a form based on the returned criteria. What...
13
by: Michael Griebe | last post by:
Simple question. I am optimizing some C++ code and I'd like to know which is faster (or if there is any difference at all) between using a switch statement or nested else-ifs. I'm partial to...
63
by: Jake Barnes | last post by:
In the course of my research I stumbled upon this article by Alex Russel and Tim Scarfe: http://www.developer-x.com/content/innerhtml/default.html The case is made that innerHTML should never...
0
by: Jay | last post by:
Can any one help? I am trying to automate my DB with VBA and need help with the following. I have a subform that shows orders for advertisements placed. I would like to read the user input to test...
2
by: epsilon | last post by:
All: I'm running into trouble figuring this one out. It seems that my decision routine is not working as intended. Does anyone know why my output continues to utilize the "else" portion of the...
11
by: Chad | last post by:
The question stems from some code at the following url http://www.cplusplus.com/reference/clibrary/cstdio/fread.html In the code example they have a single if statement for the following ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.