Date Calculations

Abbosy

Registered User.
Local time
Today, 01:52
Joined
Dec 4, 2013
Messages
59
Hi Forum

I have two date records that I need to check if first one is larger or equal then display the first date, otherwise to display the second in a new record. :confused:

Many Thanks

Abbosy
 
Hi Paul

I have a "InitialWarranty" record and "ExtendedWarranty"; they are both Date records. I need another field "Warranty" to check which one is larger then to display it. If Access can't find any warranty records in either of them then to display "No Warranty" or to display "00".

Many thanks in advance
 
Create a Text box on the Form, then use the Form Current method to set this value.
Code:
Private Sub Form_Current()
    If Me.[COLOR=Red]InitialWarranty [/COLOR]<= Me.[COLOR=Red]ExtendedWarranty [/COLOR]Then
        Me.[COLOR=Blue]yourNewTextBox [/COLOR]= Me.ExtendedWarranty
    ElseIf Me.[COLOR=Red]InitialWarranty [/COLOR]> Me.[COLOR=Red]ExtendedWarranty[/COLOR]
        Me.[COLOR=Blue]yourNewTextBox [/COLOR]= Me.InitialWarranty
    Else
        Me.[COLOR=Blue]yourNewTextBox [/COLOR]= "No Warranty"
    End If
End Sub
This does not need to be stored in the table, just create an Unbound text box. Make sure to change the control names !
 
Thanks very much Paul

One Last advice; In which event shall put the code?
 
Hi again Paul

I asked without even checking the code? So embarrassing. I do apologise.

Thanks for everything
 
Abbosy, I have produce a demo of what i think you are trying to achieve , enter your dates or leave blank for the various scenarios you wish to see in the field warranties , I have used the click event on the warranties field to trigger the result ,
Hope this is a starter
Regards Ypma

ps using a/c 2010
 

Attachments

...I have a "InitialWarranty" record and "ExtendedWarranty"; they are both Date records...

You really need to take the time to learn the Access 'ABCs,' which is to say the names of the various Access Controls and Objects. You're not talking about 'Records,' here, but rather Controls on a Form. Referring to 'Records,' in this context, is why Paul and I were confused by your original post. Being able to use the correct terms, when posting here, will make it much easier for us to give you help.

Linq ;0)>
 
Hi Missinglinq

I appreciate this and do agree with you. I know I'm not an expert in Access but I'm getting most of the results with your help. The guys are really fantastic and helpful and I will definitely take the time to learn. I will get there eventually.

Thanks again for your advice.

Regards
Abbosy
 
It is working now thanks to all of you. Much Obliged


Best Regards
Abbosy
 

Users who are viewing this thread

Back
Top Bottom