Solved Set Date in Form Field (1 Viewer)

voxy

New member
Local time
Tomorrow, 01:14
Joined
Dec 7, 2019
Messages
15
Halo Friends,

I need help to solve my problem

How to set datevalue in field

my condition is like this

if I click the command button then the "jatuh tempo" Field value will be "Tgl Tukar Faktur" + "TOP"
and after the Adding date, i want to set the datevalue to

if the date is between 31 to 9 then the datevalue will be 10
and between 10 to 19 will be 20
and between 20 to 29 will be 30

example :

Tgl Tukar Faktur : 01 Jan 2021
TOP : 30
after the addition the value of "Jatuh Tempo" should be 31 jan 2021 right?
but what I want is if the value of the "Jatuh Tempo" is not 31 Jan 2021, instead it will be 10 Feb 2021

please help me to solve this

thanks before
 

Attachments

  • 1612336090416.png
    1612336090416.png
    7.5 KB · Views: 516

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:14
Joined
May 7, 2009
Messages
19,229
try this.
 

Attachments

  • voxyDB.accdb
    452 KB · Views: 404

ypma

Registered User.
Local time
Today, 19:14
Joined
Apr 13, 2012
Messages
643
Voxy, not sure what your formula is, in you example you are adding and extra 10 days on top of your value of Field TOP , is this correct ?
Code:
Private Sub Text27_AfterUpdate()

If DatePart("d", [Text27]) < 9 Or DatePart("d", [Text27]) = 31 Then

Me.Text27 = "Top: 10"
End If


End Sub
I have had a go at the first if statement , but what next ?

if I have it completely wrong I apologise
User like you self not a professional
 

voxy

New member
Local time
Tomorrow, 01:14
Joined
Dec 7, 2019
Messages
15
Voxy, not sure what your formula is, in you example you are adding and extra 10 days on top of your value of Field TOP , is this correct ?
Code:
Private Sub Text27_AfterUpdate()

If DatePart("d", [Text27]) < 9 Or DatePart("d", [Text27]) = 31 Then

Me.Text27 = "Top: 10"
End If


End Sub
I have had a go at the first if statement , but what next ?

if I have it completely wrong I apologise
User like you self not a professional
thanks for your input.

I'll make it more detail,

I want to make about Payment's Due date

so the due date will be the date you submitted the invoice (in my case the name of the field is "Tgl Tukar Faktur") plus TOP
and my payment's only at the 10th, 20th and 30th every month and in the february case will be at 10th, 20th and 28th or 29th

so should they submitted the ivoice 01 Jan 2021 and the TOP is 30days
it should be 31jan2021 right?
but my payment's is not available in the 31th so it will be postponed the 10th of the next month

thank you and hope you can help me solving this :)

regards,
Voxy
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:14
Joined
May 7, 2009
Messages
19,229
another try:
 

Attachments

  • voxyDB.accdb
    816 KB · Views: 466

ypma

Registered User.
Local time
Today, 19:14
Joined
Apr 13, 2012
Messages
643
another try:
Arnelgp, Much better than what I could have produced, It seems to work correctly when the top amount is added manually ? The OP mentioned February and leap year could these anomalies be catered in your function ?

Regards Ypma
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:14
Joined
May 7, 2009
Messages
19,229
ok i updated the code and hopefully deal february correctly.
 

Attachments

  • voxyDB.accdb
    816 KB · Views: 488

ypma

Registered User.
Local time
Today, 19:14
Joined
Apr 13, 2012
Messages
643
ok i updated the code and hopefully deal february correctly.
Thank you arnelgp for your time . Note I am now only an interest party. The leap year now, seems to be covered , however you have omitted case 20 to 30 is there a reason for this?. Plus the TOP field is not automatically filled .

Regards " being a pain " Ypma
 

ypma

Registered User.
Local time
Today, 19:14
Joined
Apr 13, 2012
Messages
643
thanks for your input.

I'll make it more detail,

I want to make about Payment's Due date

so the due date will be the date you submitted the invoice (in my case the name of the field is "Tgl Tukar Faktur") plus TOP
and my payment's only at the 10th, 20th and 30th every month and in the february case will be at 10th, 20th and 28th or 29th

so should they submitted the ivoice 01 Jan 2021 and the TOP is 30days
it should be 31jan2021 right?
but my payment's is not available in the 31th so it will be postponed the 10th of the next month

thank you and hope you can help me solving this :)

regards,
Voxy
Voxy, arnelgp demo, when the minor snags have been sorted is your best option in my Opinion. I was working on the same lines as Arnelgp, but did not use Select case . For what its worth I am attaching the demo.
 

Attachments

  • FuturePaymentDate.accdb
    640 KB · Views: 490
Last edited:

Users who are viewing this thread

Top Bottom