Solved

access questions

Posted on 2014-12-03
3
53 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 27

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
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…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

920 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

11 Experts available now in Live!

Get 1:1 Help Now