Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA: Format Function not working in some computers 2

Status
Not open for further replies.

mini1969

Programmer
Feb 26, 2005
13
BA
Hai,

I have maintenance database program which uses the following function to join the date and time values into a single date property for easier calculation. My user requires the date and time entry in differrent fields, where its easy for me to have it in same field in database for all further processing.

Function JoinTime(inDate As Date, InTime As Date)
Dim New_Date As Date
New_Date = Format(New_Date, "General Date")
New_Date = (inDate + InTime)
JoinTime = New_Date
End Function

This "Format" is working in some computers , but not in some. All computers have the same Windows XP and MS access 2000.

Can some one guide me?

The whole program is available for download from,

regards,

Mini
 
It's probably a problem with a missing reference - i VBE - Tools | References, uncheck the reference marked as missing.

Just wonder - why do you format here? The format function returns a string, so what you are doing here, is assigning '12/30/1899' to a date variable, where there's an implicit conversion going on, then afterwards, you assign a new date. The line containing the format, could just be removed, I think...

Roy-Vidar
 
Why not simply this ?
Function JoinTime(inDate As Date, InTime As Date) As Date
JoinTime = inDate + InTime
End Function

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks both PHV & Roy. The direct aplication make things much better and trouble free.

mini
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top