Solved

Text Modify

Posted on 2014-07-30
6
191 Views
Last Modified: 2014-07-31
I have a field on form "A" with can have any of the following values

FD30, FD30S, None, FD60, FD60S, FD120 and FD120S

I want to get any one of these values and auto enter it into another none related form but without the "S" on the end leaving any of the following.

FD30, None, FD60,  and FD120

In other words get the value from form "A" strip off the "S" and paste into Form "B". I have the transfer it's just getting rid of the "S"
0
Comment
Question by:DatabaseDek
6 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 40229613
here is one way to do this
if you have the info in text1
transfer it using

dim str

str=replace(me.text1.value,"S","")
0
 
LVL 36

Accepted Solution

by:
PatHartman earned 250 total points
ID: 40229751
I think the previous suggestion will remove all S's rather than just the final one.

If Right(YourField, 1) = "S" Then
    ResultField = Left(YourField, Len(YourField) -1)
Else
    ResultField = YourField
End If

Open in new window

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40229774
well, there is only ONE "S"
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 36

Expert Comment

by:PatHartman
ID: 40229796
I agree but -
but without the "S" on the end
Implies the "S" means something on the end that it doesn't mean somewhere else in the code.  We may be seeing the complete code list so in that case taking out any "S" would work but if a new pair of codes gets added and they have an embedded "S", stripping only the ending "S" would be preferable.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40230182
In the following example, replace the string literal "FD30S" with the name of the source control/field.
target = StrReverse(Replace(StrReverse("FD30S"),"S", vbNullString,1,1))

In this case, target depends on the context/method of the data move.  If assigning a value in VBA code, it will likely be the control.value property.  If assigning in an update or insert query, it will be the name of the field receiving the data
0
 

Author Closing Comment

by:DatabaseDek
ID: 40231275
One accurately answered my question the other gave a better answer than required.

Great

Thank you both
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question