Solved

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

Posted on 2014-02-19
2
279 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 48

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views 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 Access…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

708 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

15 Experts available now in Live!

Get 1:1 Help Now