Solved

Microsoft Access Macro

Posted on 2013-01-26
4
234 Views
Last Modified: 2013-01-28
Hello,

I have an access file that I have to manually adjust.  I would like to create a macros that automates the changes.
The access file has 7 columns
I need to make changes to column 1 depending on the information of column two.
Then I need to make changes to Column 2 depending on the information in column one.

How can I go about this?

Thank you
0
Comment
Question by:cbones
  • 3
4 Comments
 
LVL 26

Expert Comment

by:jerryb30
Comment Utility
Can you give an example of the changes?
0
 

Author Comment

by:cbones
Comment Utility
Yes, sorry.

If the rows in column one say the data below than column two gets changed to this

column 1                      Column 2
test                                   T
test2                                 T2
data                                  D
data2                                D2

If the rows in column one say test then change column two to T.
If the rows in column one say test1 then change column two to T1
Etc...

But there can be about 15 different criteria.
0
 
LVL 26

Expert Comment

by:jerryb30
Comment Utility
OK, that is changing column 2 based on column 1.  What about your first requirement, change column 1 based on column 2?

It might be easiest in the instance above to make a table of possible values in column 1 and desired values in column 2. Then join that lookup table to your table, and do an update query.
0
 
LVL 26

Accepted Solution

by:
jerryb30 earned 500 total points
Comment Utility
With the data you posted, at its most simplistic,
UPDATE tblColumns SET tblColumns.Col2 = UCase(Left([col1],1)) & IIf(IsNumeric(Right([col1],1)),Right([col1],1),"");

where the table is named tblColumns
the two fields are named col and col2
Col2 is updated to the leftmost value of col2 and, if the rightmost value of col1 is a number, that number.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

743 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

8 Experts available now in Live!

Get 1:1 Help Now