Solved

How write new value to a 2nd field using the first three parts of the 1st field

Posted on 2014-02-19
2
284 Views
Last Modified: 2014-02-19
On a form I have a field that for example reads,

"Mountain Picture, 8x10, Matted, Vertical, New York"

Note that there will always be 4 character strings with commas following in every case.

Also on the form is a combobox named cboToLocation which shows column 2 from the underlying query (even though the ID field is in the first column and is bound to the field on the form.  That field might display, for example, "Rockford".

In the after update event of the cboToLocation field I want a field named "New Product", to read "Mountain Picture, 8x10, Matted, Vertical, Rockford"

In other words replace "New York" with "Rockford" in the "New Product" field.

How do I code this?

--Steve
0
Comment
Question by:SteveL13
2 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39870915
HI,

I'm not sure to understand

but maybe

strText = "Mountain Picture, 8x10, Matted, Vertical, New York"
strReplacement = "Rockford"
aText = Split(strText, ",")
aText(UBound(aText)) = strReplacement
strText = Join(aText, ",")

Open in new window

Regards
0
 

Author Comment

by:SteveL13
ID: 39870956
You understood very well.  Here is the code after I replace with real field names and added a space before the "Rockford" part of the text string...

    strText = Me.txtProductID.Column(1)
    strReplacement = Me.cboToLocation.Column(1)
    aText = Split(strText, ",")
    aText(UBound(aText)) = strReplacement
    strText = Join(aText, ", ")
    Me.txtTransferredProdRef = strText

Thank you!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

920 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

19 Experts available now in Live!

Get 1:1 Help Now