473,473 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Please, help me

Hi, fellows,

I wish to do a prodedure to actualize the vehicle's venal value, when I
update the date.

As I did, because there are 5 classes, the procedure stay very large
and crash.

If anybody can help me, I will be very grateful.

...............

Private Sub ÚltimaAlteração_BeforeUpdate(Cancel As Integer)
If Classe = "LG" And ValorNovo <= 25000 Then
If [ÚltimaAlteração] - [DataMatrícula] <= 30 Then
ValorVenal = ValorNovo * .984
End If
If [ÚltimaAlteração] - [DataMatrícula] > 30 And
[ÚltimaAlteração] - [DataMatrícula] <= 61 Then
ValorVenal = ValorNovo * 0.968
End If
If [ÚltimaAlteração] - [DataMatrícula] > 61 And
[ÚltimaAlteração] - [DataMatrícula] <= 91 Then
ValorVenal = ValorNovo * 0.952
End If
If [ÚltimaAlteração] - [DataMatrícula] > 91 And
[ÚltimaAlteração] - [DataMatrícula] <= 122 Then
ValorVenal = ValorNovo * 0.936
End If
If [ÚltimaAlteração] - [DataMatrícula] > 122 And
[ÚltimaAlteração] - [DataMatrícula] <= 152 Then
ValorVenal = ValorNovo * 0.92
End If
If [ÚltimaAlteração] - [DataMatrícula] > 152 And
[ÚltimaAlteração] - [DataMatrícula] <= 182 Then
ValorVenal = ValorNovo * 0.904
End If
If [ÚltimaAlteração] - [DataMatrícula] > 182 And
[ÚltimaAlteração] - [DataMatrícula] <= 213 Then
ValorVenal = ValorNovo * 0.888
End If
If [ÚltimaAlteração] - [DataMatrícula] > 213 And
[ÚltimaAlteração] - [DataMatrícula] <= 243 Then
ValorVenal = ValorNovo * 0.872
End If
If [ÚltimaAlteração] - [DataMatrícula] > 243 And
[ÚltimaAlteração] - [DataMatrícula] <= 274 Then
ValorVenal = ValorNovo * 0.856
End If
If [ÚltimaAlteração] - [DataMatrícula] > 274 And
[ÚltimaAlteração] - [DataMatrícula] <= 304 Then
ValorVenal = ValorNovo * 0.84
End If
If [ÚltimaAlteração] - [DataMatrícula] > 304 And
[ÚltimaAlteração] - [DataMatrícula] <= 335 Then
ValorVenal = ValorNovo * 0.824
End If
If [ÚltimaAlteração] - [DataMatrícula] > 335 And
[ÚltimaAlteração] - [DataMatrícula] <= 365 Then
ValorVenal = ValorNovo * 0.808
End If
If [ÚltimaAlteração] - [DataMatrícula] > 365 And
[ÚltimaAlteração] - [DataMatrícula] <= 395 Then
ValorVenal = ValorNovo * 0.8
End If
If [ÚltimaAlteração] - [DataMatrícula] > 395 And
[ÚltimaAlteração] - [DataMatrícula] <= 426 Then
ValorVenal = ValorNovo * 0.792
End If
If [ÚltimaAlteração] - [DataMatrícula] > 426 And
[ÚltimaAlteração] - [DataMatrícula] <= 456 Then
ValorVenal = ValorNovo * 0.784
End If
If [ÚltimaAlteração] - [DataMatrícula] > 456 And
[ÚltimaAlteração] - [DataMatrícula] <= 487 Then
ValorVenal = ValorNovo * 0.776
End If
If [ÚltimaAlteração] - [DataMatrícula] > 487 And
[ÚltimaAlteração] - [DataMatrícula] <= 517 Then
ValorVenal = ValorNovo * 0.768
End If
If [ÚltimaAlteração] - [DataMatrícula] > 517 And
[ÚltimaAlteração] - [DataMatrícula] <= 547 Then
ValorVenal = ValorNovo * 0.76
End If
If [ÚltimaAlteração] - [DataMatrícula] > 547 And
[ÚltimaAlteração] - [DataMatrícula] <= 578 Then
ValorVenal = ValorNovo * 0.752
End If
If [ÚltimaAlteração] - [DataMatrícula] > 578 And
[ÚltimaAlteração] - [DataMatrícula] <= 608 Then
ValorVenal = ValorNovo * 0.744
End If
If [ÚltimaAlteração] - [DataMatrícula] > 608 And
[ÚltimaAlteração] - [DataMatrícula] <= 639 Then
ValorVenal = ValorNovo * 0.736
End If
If [ÚltimaAlteração] - [DataMatrícula] > 639 And
[ÚltimaAlteração] - [DataMatrícula] <= 669 Then
ValorVenal = ValorNovo * 0.728
End If
If [ÚltimaAlteração] - [DataMatrícula] > 669 And
[ÚltimaAlteração] -

' and more... until 6935
End If
End Sub

.....................

Translation:

[ÚltimaAlteração] ---> Last Update
[DataMatrícula] ---> Motor-Car Date Matriculation
ValorVenal ---> Venal Value
ValorNovo ---> Value in new

Best regards,

Marcal Muralha

Jan 25 '06 #1
1 1209
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You might try something like this:

intTestValue = [ÚltimaAlteração] - [DataMatrícula]

If Classe = "LG" And ValorNovo <= 25000 Then

Select Case intTestValue
Case Is <= 30 : dblMultiplier = 0.984
Case Is <= 61 : dblMultiplier = 0.968
Case Is <= 91 : dblMultiplier = 0.952

... etc. ...

End Select

ValorVenal = ValorNovo * dblMultiplier

The Case evaluations have to be in numerical order: lowest to highest.
E.g.: If the intTestValue is between 31 and 61 the dblMultiplier will
be set to 0.968.

The reason I set it up like this to take the calculation out of the
If...Then statement and just compare one value to another. And it is
easier to read ;)
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ9fm74echKqOuFEgEQLvgACdFsmmsy2KxnsFyGCxuzaJ13 8SUSQAoOUL
cZjWA6NemqIzCNJuUQIKL9AH
=oz1T
-----END PGP SIGNATURE-----

mm******@gmail.com wrote:
Hi, fellows,

I wish to do a prodedure to actualize the vehicle's venal value, when I
update the date.

As I did, because there are 5 classes, the procedure stay very large
and crash.

If anybody can help me, I will be very grateful.

..............

Private Sub ÚltimaAlteração_BeforeUpdate(Cancel As Integer)
If Classe = "LG" And ValorNovo <= 25000 Then
If [ÚltimaAlteração] - [DataMatrícula] <= 30 Then
ValorVenal = ValorNovo * .984
End If
If [ÚltimaAlteração] - [DataMatrícula] > 30 And
[ÚltimaAlteração] - [DataMatrícula] <= 61 Then
ValorVenal = ValorNovo * 0.968
End If
If [ÚltimaAlteração] - [DataMatrícula] > 61 And
[ÚltimaAlteração] - [DataMatrícula] <= 91 Then
ValorVenal = ValorNovo * 0.952
End If
If [ÚltimaAlteração] - [DataMatrícula] > 91 And
[ÚltimaAlteração] - [DataMatrícula] <= 122 Then
ValorVenal = ValorNovo * 0.936
End If
If [ÚltimaAlteração] - [DataMatrícula] > 122 And
[ÚltimaAlteração] - [DataMatrícula] <= 152 Then
ValorVenal = ValorNovo * 0.92
End If
If [ÚltimaAlteração] - [DataMatrícula] > 152 And
[ÚltimaAlteração] - [DataMatrícula] <= 182 Then
ValorVenal = ValorNovo * 0.904
End If
If [ÚltimaAlteração] - [DataMatrícula] > 182 And
[ÚltimaAlteração] - [DataMatrícula] <= 213 Then
ValorVenal = ValorNovo * 0.888
End If
If [ÚltimaAlteração] - [DataMatrícula] > 213 And
[ÚltimaAlteração] - [DataMatrícula] <= 243 Then
ValorVenal = ValorNovo * 0.872
End If
If [ÚltimaAlteração] - [DataMatrícula] > 243 And
[ÚltimaAlteração] - [DataMatrícula] <= 274 Then
ValorVenal = ValorNovo * 0.856
End If
If [ÚltimaAlteração] - [DataMatrícula] > 274 And
[ÚltimaAlteração] - [DataMatrícula] <= 304 Then
ValorVenal = ValorNovo * 0.84
End If
If [ÚltimaAlteração] - [DataMatrícula] > 304 And
[ÚltimaAlteração] - [DataMatrícula] <= 335 Then
ValorVenal = ValorNovo * 0.824
End If
If [ÚltimaAlteração] - [DataMatrícula] > 335 And
[ÚltimaAlteração] - [DataMatrícula] <= 365 Then
ValorVenal = ValorNovo * 0.808
End If
If [ÚltimaAlteração] - [DataMatrícula] > 365 And
[ÚltimaAlteração] - [DataMatrícula] <= 395 Then
ValorVenal = ValorNovo * 0.8
End If
If [ÚltimaAlteração] - [DataMatrícula] > 395 And
[ÚltimaAlteração] - [DataMatrícula] <= 426 Then
ValorVenal = ValorNovo * 0.792
End If
If [ÚltimaAlteração] - [DataMatrícula] > 426 And
[ÚltimaAlteração] - [DataMatrícula] <= 456 Then
ValorVenal = ValorNovo * 0.784
End If
If [ÚltimaAlteração] - [DataMatrícula] > 456 And
[ÚltimaAlteração] - [DataMatrícula] <= 487 Then
ValorVenal = ValorNovo * 0.776
End If
If [ÚltimaAlteração] - [DataMatrícula] > 487 And
[ÚltimaAlteração] - [DataMatrícula] <= 517 Then
ValorVenal = ValorNovo * 0.768
End If
If [ÚltimaAlteração] - [DataMatrícula] > 517 And
[ÚltimaAlteração] - [DataMatrícula] <= 547 Then
ValorVenal = ValorNovo * 0.76
End If
If [ÚltimaAlteração] - [DataMatrícula] > 547 And
[ÚltimaAlteração] - [DataMatrícula] <= 578 Then
ValorVenal = ValorNovo * 0.752
End If
If [ÚltimaAlteração] - [DataMatrícula] > 578 And
[ÚltimaAlteração] - [DataMatrícula] <= 608 Then
ValorVenal = ValorNovo * 0.744
End If
If [ÚltimaAlteração] - [DataMatrícula] > 608 And
[ÚltimaAlteração] - [DataMatrícula] <= 639 Then
ValorVenal = ValorNovo * 0.736
End If
If [ÚltimaAlteração] - [DataMatrícula] > 639 And
[ÚltimaAlteração] - [DataMatrícula] <= 669 Then
ValorVenal = ValorNovo * 0.728
End If
If [ÚltimaAlteração] - [DataMatrícula] > 669 And
[ÚltimaAlteração] -

' and more... until 6935
End If
End Sub

....................

Translation:

[ÚltimaAlteração] ---> Last Update
[DataMatrícula] ---> Motor-Car Date Matriculation
ValorVenal ---> Venal Value
ValorNovo ---> Value in new

Best regards,

Marcal Muralha

Jan 25 '06 #2

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

Similar topics

1
by: Numberwhun | last post by:
Hello everyone! I am trying to learn java and have run into kind of a snag. Here is the code that I have so far: ------ <begin_code> ---------- import javax.swing.*; import...
1
by: HolaGoogle | last post by:
Hi all, Please help me with the following..it's realy urgent and i tried everything i could and i can't get it work properly!! Thanks in advance. Here's what i'm trying to accomplish: in my...
0
by: s_erez | last post by:
Hi, This is a realy tricky one. I have an ASP.NET application where some pages are reading data from a DB and presenting reports. In order for the user to wait while the page is reading data from...
2
by: rked | last post by:
I get nameSPAN1 is undefined when I place cursor in comments box.. <%@ LANGUAGE="VBScript" %> <% DIM ipAddress ipAddress=Request.Servervariables("REMOTE_HOST") %> <html> <head> <meta...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
1
PEB
by: PEB | last post by:
POSTING GUIDELINES Please follow these guidelines when posting questions Post your question in a relevant forum Do NOT PM questions to individual experts - This is not fair on them and...
4
by: fatboySudsy | last post by:
Hi, I have constructed a client program that has given me some error codes that i just cannot see. I was wondering if a different set of eyes with much more experience than me could help me out. ...
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,...
1
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.