Full Version: SELECT STATEMENTS
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
ASHLEY0578
I need to figure out how to get this to work and save in a MS Access query. The code is from the programming in the actual program we use. What I need my query to show is the account # and this code which lets me know what the current amount on that loan is due. How can I make this happen.

Select Case intPayT
Case Is = 52
GetNumDays = 7
Case Is = 24
GetNumDays = 15
Case Is = 26
GetNumDays = 14
Case Is = 12
GetNumDays = 30
Case Else
GetNumDays = 1
End Select


If DATE() - [CONTR_DATE] > 0 Then

Select Case Pay Type
Case Is = 52
intP = 7
Case Is = 24
intP = 15
Case Is = 26
intP = 14
Case Is = 12
intP = 30
Case Else
intP = 1
End Select
'
Select Case intP
Case Is = 15
intTemp = Int(1 + (Int(DATE() - [CONTR_DATE]) / 15.2))
Case Is = 30
intTemp = 1 + Int((DATE() - [CONTR_DATE]) / 30.6)
Case Else
intTemp = 1 + Int(((DATE() - [CONTR_DATE]) / intP))
End Select
'
If intP <> 1 Then
dblPast = intTemp * [PAYMENT] - [SHORT_AMT]
If dblPast > [CUR_BALANCE] Then
dblPast = [CUR_BALANCE] + Int((DATE() - [LAST_INTR_DATE]) * [CUR_BALANCE] * [APR] / 365) / 100
End If
Else
dblPast = [CUR_BALANCE] + Int((DATE() - [LAST_INTR_DATE]) * [CUR_BALANCE] * APR / 365) / 100
End If
mfrick6
Hello,


Welcome to UA,


You say this code of from a program? Is this from an Access db or another program. If from another program can use export results? Give me some more info.

Thanks
ASHLEY0578
The software we are using uses an oracle db. I can import/link to the oracle through odbc which allows me to make the reports my bosses ask for. The code that I posted came from the company that made the software we are using. This code should result in the actual payment a customer owes. All the fields in the code are in one table called AMSUSER_LOAN. I'm probably going about this wrong but what I need to do is query the table to get the acct # and the payment the customer actually owes.

Thanks!
mfrick6
It sounds like you answered your own question. Link to the tbl AMSUSER_LOAN then build a qry to show the acct#. + amount due. You can use calculated expressions within the qry to calc values needed but you may not STORE calculated values in a tbl. This is against the rules.

To do an Expression within a qry I am assuming you having the following fields in the tbl:
CUR_BALANCE
LAST_INTR_DATE
CUR_BALANCE
APR
Account #

In the first FIELD type the following:

dblPast: [CUR_BALANCE] + Int((DATE() - [LAST_INTR_DATE]) * [CUR_BALANCE] * [APR] / 365) / 100

Second FIELD select the Accourt# Field Name
Accourt#

The results will display the results of the equation with a Field name of dblPast and the account number. Since the tbl is linked each time you run the qry you will get updated info. Making Sense?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.