what to use for holding imported data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasad joshi
    New Member
    • Aug 2012
    • 30

    #1

    what to use for holding imported data

    hello...


    I want to import table in my application and i want to store it temporary so that i can make calulation


    after making calculation that temporary data should be dump


    how to implement this program

    how to store i/p table temporary in my access vba application

    I am new to this....
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    There are several ways of doing this.

    You could use the same table each time and simply use a delete query from code when your done with your calculations, or when you close your form, or when you close the application or.....


    You could create the table on the fly with VBA code, or again, by using a query, do the import, then delete the table by VBA code or query.


    Really it depends on more details about how you want it to function, and how you want to do it. My personal preference is almost always to use VBA, but in the end, you are the one who has to implement it.

    Where do you get your temporary data from? Is it always in the same format?

    Comment

    • prasad joshi
      New Member
      • Aug 2012
      • 30

      #3
      can you tell me how to create temporary table to hold imported data

      this table should be dump after entire operation

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        This is an example of a query that will create a table tbl_Temp and insert data from tbl_User:
        Code:
        SELECT tbl_User.PK_User, 
               tbl_User.tx_UserInitials INTO tbl_Temp
               FROM tbl_User;
        Another example creating the table by code:
        Code:
        Public Sub generateExportTable(strTableName As String, Optional bHazards As Boolean = False)
        'This procedure creates a temporary table to be used in a report or to be exported for review
         
            'If teh table allready exists, delete it
            If TableExists(strTableName) Then
                DoCmd.DeleteObject acTable, strTableName
            End If
                
            
            'Create the table
                Dim tblDef As TableDef
                Dim db As Database
                Set db = CurrentDb
                Set tblDef = db.CreateTableDef(strTableName, , , CurrentProject.Connection)
                Dim fld As Field
                
                
            With tblDef
                If bHazards Then
                    .Fields.Append .CreateField("lngSortNumber", dbLong)
                    .Fields("lngSortNumber").Attributes = dbAutoIncrField
                End If
                .Fields.Append .CreateField("lngReqID", dbLong)
                .Fields.Append .CreateField("txtSectionNumber", dbText, 50)
                .Fields.Append .CreateField("txtType", dbText, 20)
                .Fields.Append .CreateField("txtRevision", dbText, 10)
                .Fields.Append .CreateField("memSpecifikation", dbMemo)
                If bHazards Then
                    .Fields.Append .CreateField("Comments", dbMemo)
                    .Fields("Comments").AllowZeroLength = True
                    .Fields.Append .CreateField("Hazard nr", dbMemo)
                    .Fields("Hazard nr").AllowZeroLength = True
                    .Fields.Append .CreateField("Hazards", dbMemo)
                    .Fields("Hazards").AllowZeroLength = True
                End If
                
            End With
            
            tblDef.Fields("txtSectionNumber").AllowZeroLength = True
            ' Append the new TableDef to the database.
                db.TableDefs.Append tblDef
        End Sub
        Not all of the above code is required, some is specialized for my need, but this gives you an example.

        Comment

        Working...