Solved Adding Time to current time and date (1 Viewer)

theinviter

Registered User.
Local time
Today, 04:31
Joined
Aug 14, 2014
Messages
237
Dear guys;

I have a problem need help please ,
i have following field :
Time = Format(Now(), "short time")
BUD_Time = (Time entered by user in hours)
exp_date = Date
Item= product name

so i want when user double click on exp_date then do following action:

Private Sub exp_date_DblClick(Cancel As Integer)
exp_date = Date + BUD
time = Format(Now(), "short time")

Else

exp_date = Date
time = Format(Now(), "short time") + BUD_Time
due_date = Date
[time 1] = Format(Now(), "short time")
End If


I got this Error with Highlighted code " Type mismatch" .

so i want upon double click the time (now) added to BUD_Time entered by user to show in field Time. and if result exceed 24 hours then update exp_date to next date.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:31
Joined
Oct 29, 2018
Messages
21,358
Hi. Assuming BUD_Time is a date/time datatype, try it this way:
Code:
time = Format(Now() + BUD_Time, "short time")
PS. "time" is a reserved word in Access. You might consider using another name for your field.
 

theinviter

Registered User.
Local time
Today, 04:31
Joined
Aug 14, 2014
Messages
237
Hi. Assuming BUD_Time is a date/time datatype, try it this way:
Code:
time = Format(Now() + BUD_Time, "short time")
PS. "time" is a reserved word in Access. You might consider using another name for your field.
thanks alot
work good

but if result exceed 24 hours then update exp_date to next date.
how to do this
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:31
Joined
Oct 29, 2018
Messages
21,358
thanks alot
work good

but if result exceed 24 hours then update exp_date to next date.
how to do this
What do you mean by "exceed 24 hours?" Are you saying past midnight today?
 

theinviter

Registered User.
Local time
Today, 04:31
Joined
Aug 14, 2014
Messages
237
Okay, then you could try comparing [time] with Date() to see if they're different. If so, update exp_date to Date+1.
resolved thank alot
exp_date = Format(Now() + BUD_Time, "short Date")
 

Users who are viewing this thread

Top Bottom