473,394 Members | 1,658 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,394 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 2532

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
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.