Solved

Text Modify

Posted on 2014-07-30
6
190 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 35

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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 35

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

772 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