Solved

access questions

Posted on 2014-12-03
3
48 Views
Last Modified: 2016-07-11
1)what is staging table?
2) how do i write a vba code with that import an excel file into a table with a message box "import was succesfull"?
0
Comment
Question by:akinamon1
3 Comments
 
LVL 26

Accepted Solution

by:
MacroShadow earned 250 total points
ID: 40480154
1) A table is a SQL used when importing external data. It isn't an Access feature or concept.
2) That very much depends on the scenario, here is some generic code which should get you started:

Sub Demo

        Dim strFile As String
        Dim strTable As String
        Dim blnHasFieldNames As Boolean

        ' Change this next line to True if the first row in EXCEL worksheet
        ' has field names
        blnHasFieldNames = False

        ' Replace tablename with the name of the destination table name
        strTable = "tablename"

        ' Change C:\Temp\Temp.xlsx with the full file name and path of the Excel file
        strFile = "C:\Temp\Temp.xlsx"

        DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strTable, strPathFile, blnHasFieldNames

End Sub

Open in new window

0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 250 total points
ID: 40480229
1. A sort of temporary table. In most cases, you won't have a need for it.

2. Often the best method is not to import the Excel data but link them. Then create a simple select query that pulls the data from the linked table and performs basic filtering for empty records/fields and conversion (like converting text fields to numeric or date) which you would use in any case where these data will be used in your application. Also, alias can be applied to field names, indeed where you have none and the have received the default F1, F2, etc.

Now, use the query from #2 as the source whenever you need to pull data from the Excel file.

/gustav
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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

747 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

13 Experts available now in Live!

Get 1:1 Help Now