|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Creating and populating a table in Access with VB coding
I have currently been given a task to re-work some current coding within Access. This is well above my understanding of Access and was hoping to get a little assistance with some simple coding language.
The database I am manipulating has data collected from tourists about their destinations and origins. I wish to create 2 tables based on a current table. One table will be short trips (trip length <= 150km) and the other long trips (trip length < 150kms) I wish for these tables to be created from a table of raw data upon the click of a button (GUI interface). If you are puzzled by my question. I'll try to make it simplier by asking: 1. what line of code will create a new table overriding old 2. what type of code is required to create this table with specific column headings? 3. How do I import information from current available tables with the condition: 'Row Y' is > X |
|
#2
|
||||
|
||||
|
Please advise what you mean by table of raw data,.?
Why would you create a new table overiding old? From what you've explained you will be breaking the rules of database normalisation by creating multiple tables for trip lenghts. You will need to explain more about how your db is intended to work if you wish to receive more benificial help. |
|
#3
|
|||
|
|||
|
Why would you separate identical information? Why not keep it in one table and just add an indicator (Believe me this will make things easier on you in the long run)
So let's say your table currently looks like this: Code:
CustomerID CustomerStart CustomerEnd Miles 1 Miami Daytona Bch 90 1 Madison Green Bay 200 Instead of separating this into two tables you can add a field: Code:
CustomerID CustomerStart CustomerEnd Miles TripType 1 Miami Daytona Bch 90 1 Madison Green Bay 200 Then you could run an update query that was something like: Code:
UPDATE Tbl_Trips SET Tbl_Trips.TripType = IIf([Miles]>=150,"L","S"); I'm assuming here that the table name in my example is called Tbl_Trips and I'm using L for Long Trip and S for Short Trip. Building a table every time you want to split your table is really inefficient and there's no real reason to do it.
__________________
---------------- If we've helped you and you have solved your problem please post that it's been resolved so we know! The suspense kills me! |
|
#4
|
||||
|
||||
|
ugggh, this is getting borderline of "Don't do it this way!!"
You do the sort of short/long trips with the query..... the "raw" data is the miles whether short or long. Instead of making 2 tables holding the exact same data, make 1 table and 2 queries.
__________________
Did I help you? If so gimme rep by clicking on the at the top right corner of this post ![]() Madness does not always howl. Sometimes, it is the quiet voice at the end of the day saying, "Hey, is there room in your head for one more?" |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Creating and populating a table in Access with VB coding |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|