473,657 Members | 2,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Switch values based on another field

I am trying to change the value of one field in my query based on the value
in another. If Field 1 had the text "ONACCNT" then in Feild 2 I want the
date to change to today's date. Any help would be great!
Thanks,

Greg
Nov 12 '05 #1
6 4686
It's not completely clear what you're trying to do here.
Is Feild 2 a field in an underlying table, which you want to update with an
action query?
Or is Feild 2 a field whose value is calculated in the query itself?
In this case, what do you want the field to display if Field 1 does not
contain ONACCNT?

HTH
- Turtle
"Greg" <gk******@itlan .net> wrote in message
news:vp******** ****@corp.super news.com...
I am trying to change the value of one field in my query based on the value in another. If Field 1 had the text "ONACCNT" then in Feild 2 I want the
date to change to today's date. Any help would be great!
Thanks,

Greg

Nov 12 '05 #2
In the table I have a field that holds the customer Invoice # and another
field with the Invoice date. I am trying to get the total due for the
invoices due current, over 30, over 60 , over 90, over 120. I ran into on
little snag thought since the customer can be pulling from an ON Account
balance that they have already paid. The date that the On Account was
created falls under the Invoice date and throws my numbers off. What I am
trying to do is get the ON Accounts invoice dates to change to Today's date
just for the query so I can print out a report NOT a permanent change since
this is pulling from an ODBC Database connection. For all other invoices I
want the dates to stay as they are. I hope this makes more sense......

Thanks,

Greg

"Greg" <gk******@itlan .net> wrote in message
news:vp******** ****@corp.super news.com...
I am trying to change the value of one field in my query based on the value in another. If Field 1 had the text "ONACCNT" then in Feild 2 I want the
date to change to today's date. Any help would be great!
Thanks,

Greg

Nov 12 '05 #3
"Greg" <gk******@itlan .net> wrote in
news:l7******** *****@nwrdny03. gnilink.net:
In the table I have a field that holds the customer Invoice #
and another field with the Invoice date. I am trying to get
the total due for the invoices due current, over 30, over 60
, over 90, over 120. I ran into on little snag thought since
the customer can be pulling from an ON Account balance that
they have already paid. The date that the On Account was
created falls under the Invoice date and throws my numbers
off. What I am trying to do is get the ON Accounts invoice
dates to change to Today's date just for the query so I can
print out a report NOT a permanent change since this is
pulling from an ODBC Database connection. For all other
invoices I want the dates to stay as they are. I hope this
makes more sense......

Thanks,

Greg


I posted some crosstab query code to you tuesday night. you might
modify that as follows to handle your exception for ONACCT

Select Cust_Code,
30 * iif((now()-iif(ON,now(),In v_due_Date))\30 >4, 4,
(now()-iif(ON,now(),In v_due_Date)\30) ) as Aging,
Sum(INV_Bal)
From Invoices
Group by cust_code, iif((now()-iif(ON,now(),In v_due_Date))\30 >4, 4,
(now()-iif(ON,now(),In v_due_Date))\30 );

Bob Q.

Nov 12 '05 #4
Sorry Bob........... I did not make it clear that the ONACCNT is in the
Invoice Field. I need anything that has ONACCNT to place the current date
in the Invoice date field. Thanks again for your help.
Greg

"Bob Quintal" <bq******@gener ation.net> wrote in message
news:9a******** *************** *******@news.te ranews.com...
"Greg" <gk******@itlan .net> wrote in
news:l7******** *****@nwrdny03. gnilink.net:
In the table I have a field that holds the customer Invoice #
and another field with the Invoice date. I am trying to get
the total due for the invoices due current, over 30, over 60
, over 90, over 120. I ran into on little snag thought since
the customer can be pulling from an ON Account balance that
they have already paid. The date that the On Account was
created falls under the Invoice date and throws my numbers
off. What I am trying to do is get the ON Accounts invoice
dates to change to Today's date just for the query so I can
print out a report NOT a permanent change since this is
pulling from an ODBC Database connection. For all other
invoices I want the dates to stay as they are. I hope this
makes more sense......

Thanks,

Greg


I posted some crosstab query code to you tuesday night. you might
modify that as follows to handle your exception for ONACCT

Select Cust_Code,
30 * iif((now()-iif(ON,now(),In v_due_Date))\30 >4, 4,
(now()-iif(ON,now(),In v_due_Date)\30) ) as Aging,
Sum(INV_Bal)
From Invoices
Group by cust_code, iif((now()-iif(ON,now(),In v_due_Date))\30 >4, 4,
(now()-iif(ON,now(),In v_due_Date))\30 );

Bob Q.

Nov 12 '05 #5
"Greg" <gk******@itlan .net> wrote in
news:Zd******** ******@nwrdny03 .gnilink.net:
Sorry Bob........... I did not make it clear that the ONACCNT
is in the Invoice Field. I need anything that has ONACCNT to
place the current date in the Invoice date field. Thanks
again for your help.
Greg
replace the word ON with invoice="ONACCT " and it should work.

Alternatively, in the query that underlies your report, you could
just filter out your ONACCT values, because they should not be
listed with the invoices due, they are prepaid.

Bob

"Bob Quintal" <bq******@gener ation.net> wrote in message
news:9a******** *************** *******@news.te ranews.com...
"Greg" <gk******@itlan .net> wrote in
news:l7******** *****@nwrdny03. gnilink.net:
> In the table I have a field that holds the customer Invoice
> # and another field with the Invoice date. I am trying to
> get the total due for the invoices due current, over 30,
> over 60 , over 90, over 120. I ran into on little snag
> thought since the customer can be pulling from an ON
> Account balance that they have already paid. The date that
> the On Account was created falls under the Invoice date and
> throws my numbers off. What I am trying to do is get the
> ON Accounts invoice dates to change to Today's date just
> for the query so I can print out a report NOT a permanent
> change since this is pulling from an ODBC Database
> connection. For all other invoices I want the dates to
> stay as they are. I hope this makes more sense......
>
> Thanks,
>
> Greg


I posted some crosstab query code to you tuesday night. you
might modify that as follows to handle your exception for
ONACCT

Select Cust_Code,
30 * iif((now()-iif(ON,now(),In v_due_Date))\30 >4, 4,
(now()-iif(ON,now(),In v_due_Date)\30) ) as Aging,
Sum(INV_Bal)
From Invoices
Group by cust_code,
iif((now()-iif(ON,now(),In v_due_Date))\30 >4, 4,
(now()-iif(ON,now(),In v_due_Date))\30 );

Bob Q.



Nov 12 '05 #6
Thanks Bob I made the change last night and the totals are matching up for
me now. The problem with the ONACCNT is that the program we are using shows
it as a invoice with a negative number so before I found this little tid bit
out I was getting totals that would not match a report they have in the
program. I also had to make a change to the code you sent me because I
needed it to show everything 30 days and under as current and everything
31-60 days as over 30, 61-90 as over 90, etc.....

Thanks again for all of your help getting this to work.
Greg

"Bob Quintal" <bq******@gener ation.net> wrote in message
news:62******** *************** *******@news.te ranews.com...
"Greg" <gk******@itlan .net> wrote in
news:Zd******** ******@nwrdny03 .gnilink.net:
Sorry Bob........... I did not make it clear that the ONACCNT
is in the Invoice Field. I need anything that has ONACCNT to
place the current date in the Invoice date field. Thanks
again for your help.
Greg


replace the word ON with invoice="ONACCT " and it should work.

Alternatively, in the query that underlies your report, you could
just filter out your ONACCT values, because they should not be
listed with the invoices due, they are prepaid.

Bob

"Bob Quintal" <bq******@gener ation.net> wrote in message
news:9a******** *************** *******@news.te ranews.com...
"Greg" <gk******@itlan .net> wrote in
news:l7******** *****@nwrdny03. gnilink.net:

> In the table I have a field that holds the customer Invoice
> # and another field with the Invoice date. I am trying to
> get the total due for the invoices due current, over 30,
> over 60 , over 90, over 120. I ran into on little snag
> thought since the customer can be pulling from an ON
> Account balance that they have already paid. The date that
> the On Account was created falls under the Invoice date and
> throws my numbers off. What I am trying to do is get the
> ON Accounts invoice dates to change to Today's date just
> for the query so I can print out a report NOT a permanent
> change since this is pulling from an ODBC Database
> connection. For all other invoices I want the dates to
> stay as they are. I hope this makes more sense......
>
> Thanks,
>
> Greg

I posted some crosstab query code to you tuesday night. you
might modify that as follows to handle your exception for
ONACCT

Select Cust_Code,
30 * iif((now()-iif(ON,now(),In v_due_Date))\30 >4, 4,
(now()-iif(ON,now(),In v_due_Date)\30) ) as Aging,
Sum(INV_Bal)
From Invoices
Group by cust_code,
iif((now()-iif(ON,now(),In v_due_Date))\30 >4, 4,
(now()-iif(ON,now(),In v_due_Date))\30 );

Bob Q.


Nov 12 '05 #7

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

Similar topics

10
10903
by: Myster Ious | last post by:
Polymorphism replaces switch statements, making the code more compact/readable/maintainable/OO whatever, fine! What I understand, that needs to be done at the programming level, is this: a switch-case has a variable (most probably an enumeration) & associated symbols or integral value. Selection is made, base on what symbol/value the variable holds. So
2
2079
by: AA Arens | last post by:
Somebody willing to assist me in the following? I want to have values from one field copied to another field when I choose choose a item from a drop down menu. I have 2 forms: 1 Company contact info 2 Employee contact info When I finished form 1, I jump to form 2.
3
19735
by: pgraeve | last post by:
I am a convert from VB to C# so bear with me on this "conversion" question C# switch statement seems to be the closest relative to VB's Select Case. I used VB's Select Case statement liberally. Now I find myself wanting to use "Select Case" i.e., "switch" in C# regularly, but I always have to find another way b/c C#'s switch statement only allows static or integral variables. For example, I often want to use a switch statement based on the...
13
4524
by: Fei Liu | last post by:
Hi Group, I've got a problem I couldn't find a good solution. I am working with scientific data files in netCDF format. One of the properties of netCDF data is that the actual type of data is only known at run time. Therefore a lot of template based trick isn't too useful. Considering datafile float x(3) 3.5, 2.5, 8.9 double y(3) 2.7, -2.3, 1.2 int z(3) 5, 2, 3
6
1844
by: Sanjay | last post by:
Hi, Is it possible to save all the names/values of a form to another memo textfield before a Insert to the database then when required on another page split that memo textfield into the name and their corresponding values retrieved from the recordset ? Thanks, Sanj
7
1992
by: cytec123187 | last post by:
Hello, I am working on an Adobe Acrobat file that uses javascript for calculations. I am trying to create a field that uses two other fields to determine a number value. I think this requires a switch within a switch, but I am not sure how to do this, as I am a beginner when it comes to javascript. In esscense, I want to set up a code so that each case of value A is calculated at each case of value B. Example:
1
1881
by: Rajasuds | last post by:
I have a question in MS Access I have two tables MASTER with Fields 1, Field 2, Field 3 TRANS with Field1, Field 2, Field,10 I need to set up a look up condition where, I need !Field 2 to have options picked up from Table MASTER based on values entered in Field 1. Is this possible in table design view ? If yes how ?
12
12312
by: | last post by:
Is it fine to call another method from Switch? Eg. Switch (stringVar) { case ("a"): somVar = "whatever"; Another_Method(); //call another method return;
6
1795
by: asadikhan | last post by:
Hello, I have a bit of a design issue around this application I am developing, and I just want to run it through some of the brains out here. So I have a table called ErrorCheck which contains fields ErrorID (PK) and ErrorName. There is another table called Client which contains fields ClientID (PK) and ClientName. Then there is a relationship table called ClientErrorCheck which contains foreign keys ErrorID and
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.