Replace text field values

M

M. Jackman

I used to work with RPG/400 which has a command that works
like this:

MOVEL moves the value of the first field to the leftmost
part of the value of the second field
MOVER moves the value of the first field to the rightmost
part of the value of the second field

Example:
Command Field1 Field2 Result
MOVEL 123 00000 12300
MOVER 123 00000 00123

How can I achieve this same results with Access and VBA?
Is there a similar function in MS Access or VB??
 
P

PC Datasheet

There are no built-in functions like this!

You have to have someway of determining whether to apply MOVEL or MOVER, a
source for the value of Field1 and a source for the value of Field2. These could
be a table, user data entry or a multitude of other.

If ?? = MOVEL then
Me!Result = Me!Field1 & Mid(Field2,Len(Field1)+1)
ElseIf ?? = MOVER then
Me!Result = Left(Field2),Len(Field1)-1) & Me!Field1
Else
Msgbox "MOVEL or MOVER was not specified"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top