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

Using TRUNCATE command in Access

Status
Not open for further replies.

bowettwow

Programmer
Aug 1, 2002
57
GB
I have seen tutorials which describe the TRUNCATE command in SQL. It does exactly what I want but I cant seem to get Access to recognise it. Any ideas???

Thanks in advance,

BowettWow
 
There is no "TRUNCATE" function, per se, in Access VBA - however, there are several string and number functions which might serve to mimic it:

TRIM
LEFT
MID
RIGHT
INT
RND
FORMAT

and so on. Not sure which you will need, but check them all - to some people, TRUNCATE means simply displaying <numbers> with less decimal places, while to others, TRUNCATE means chopping off Characters or Digits in the original value.

Jim Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Just realised I didn't actually explain what I wanted the truncate function to do. I read this....


Which seemed to explain an sql function that deleted a table and set the auto number field back to one. This is exactly what I want o do and seems like an elegant way of doing it. However, Access does not seem to recognise it as an sql function. Any ideas,

Cheers,

BowettWow
 
Hmmm..yes, your second post is not quite what I had in mind either! LOL

If Access's implementation of SQL does not support the TRUNCATE command, the only way I know of to do this same thing is to &quot;delete * from [table-name]&quot; and do a compact/repair.

Jim Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Your last solution is one I found and ended up using. It does seem odd that Access doesn't support it. Oh well.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top