Solved

Text Modify

Posted on 2014-07-30
6
184 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 119

Assisted Solution

by:Rey Obrero
Rey Obrero 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 34

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 119

Expert Comment

by:Rey Obrero
ID: 40229774
well, there is only ONE "S"
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 34

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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.

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now