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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Functions in Access

Status
Not open for further replies.

eilob

Programmer
Mar 28, 2007
54
IE
Hi all, I need to take the first two or three characters from a text depending if the hour has two or three characters, there is any function in access that will take the first characters until finds this symbol :)) or will delete the last four characters?

78:39:06
78:08:48
195:06:22
71:24:16
122:38:42
22:21:07
477:02:13
42:03:00
91:15:34

Thanks in advance
 
You can use the Left() function to grab X number of characters from the left side of a string. There is an Instr() function that will return the position of a specific character or characters in a string. You can combine these two functions to accomplish your task.

You can search Help (while in a module) or google for VBA string functions to get the correct syntax.

Duane
Hook'D on Access
MS Access MVP
 
You may also consider the Left and Len functions.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 





or
[tt]
INT((DateValue([YourStringField])+TimeValue([YourStringField]))*24)
[/tt]


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
BTW, why not simply this ?
Val([your field])

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
If your variable is called foo then type:

LEFT(foo,InStr(foo,":")-1)

HTH

Clemens
 
Thanks all for your help!!!

Rgds

Eilob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top