How to do vba code in a access table

lg5050

Registered User.
Local time
Yesterday, 23:57
Joined
Nov 26, 2014
Messages
25
Hi i need to know how to do vb code to an access table step by step. Not sure how to make the code work to the table. I want to add a column to a table and i don't know where to start.:confused:
 
You cannot add VBA events to an Access table. Further, you shouldn't be creating VBA that adds columns to a table, that usually signifies a poor table structure to begin with.

Take 2 steps back and explain what you would like to occur in more detail. Omitting database jargon would be helpful as well. Don't talk in terms of tables and columns and code. Explain this to us like we had no idea what a database is.
 
Well i have a database that has 40,000 some fields and all the datatypes are in text and i want to change some of the datatype to a number but if i try to i get a message that says: Some data may be lost and i will lost that data. So i figured if i tried to add a column i could transfer the data into a new field and delete the old one.
 
To do that:

1. Make a backup of your database
2. Add the new fields to your tables with the appropriate data types
3. Create an UPDATE query to move the data from the old fields to the new fields
4. Verify the data moved succesfully (investigate any errors)
5. Once moved succesfully, delete the old columns.
6. Rename the new columns to the names of the old columns if necessary.
 
You will loose any non number data.
If you have some mixed you will be left with numbers only.
Any leading zeroz will be lost too.
 
Yes you are correct. When i do that like if i have 7.56 it would be a whole number and i don't want that. Is there any else that i can do to solve this problem.
 
When i do that like if i have 7.56 it would be a whole number and i don't want that.

No that will not occur. As long as you assign the appropriate data type for the value you want to store.
 

Users who are viewing this thread

Back
Top Bottom