Solved

Microsoft Access Macro

Posted on 2013-01-26
4
238 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
ID: 38822610
Can you give an example of the changes?
0
 

Author Comment

by:cbones
ID: 38822620
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
ID: 38822631
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
ID: 38822664
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

777 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