Making data shorter (1 Viewer)

cstuckey

Registered User.
Local time
Today, 08:07
Joined
Mar 6, 2000
Messages
23
Can you please help me?

I'm trying to change my data in a field to delete anything after the "-". For example: XXXX-XXX to XXXX. I want to do this using a query. Can you tell me how to write this function?

Thanks!
 

dcx693

Registered User.
Local time
Today, 03:07
Joined
Apr 30, 2003
Messages
3,265
Use an update query with this as the update to expression:
Left([your_field],Instr(1,[your_field],"-")-1)

Assuming all entries have a "-" in them. For example:
Left("XXXX-XXX",Instr(1,"XXXX-XXX","-")-1)
yields "XXXX"
 

Mile-O

Back once again...
Local time
Today, 08:07
Joined
Dec 10, 2002
Messages
11,316
UPDATE MyTable
SET [MyField] = Left([MyField], 4)
WHERE Len([MyField]) > 4;
 

Users who are viewing this thread

Top Bottom