By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,192 Members | 1,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,192 IT Pros & Developers. It's quick & easy.

what to use for holding imported data

P: 30

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....
Aug 24 '12 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 100+
P: 2,321
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?
Aug 24 '12 #2

P: 30
can you tell me how to create temporary table to hold imported data

this table should be dump after entire operation
Aug 24 '12 #3

Expert Mod 100+
P: 2,321
This is an example of a query that will create a table tbl_Temp and insert data from tbl_User:
Expand|Select|Wrap|Line Numbers
  1. SELECT tbl_User.PK_User, 
  2.        tbl_User.tx_UserInitials INTO tbl_Temp
  3.        FROM tbl_User;
Another example creating the table by code:
Expand|Select|Wrap|Line Numbers
  1. Public Sub generateExportTable(strTableName As String, Optional bHazards As Boolean = False)
  2. 'This procedure creates a temporary table to be used in a report or to be exported for review
  4.     'If teh table allready exists, delete it
  5.     If TableExists(strTableName) Then
  6.         DoCmd.DeleteObject acTable, strTableName
  7.     End If
  10.     'Create the table
  11.         Dim tblDef As TableDef
  12.         Dim db As Database
  13.         Set db = CurrentDb
  14.         Set tblDef = db.CreateTableDef(strTableName, , , CurrentProject.Connection)
  15.         Dim fld As Field
  18.     With tblDef
  19.         If bHazards Then
  20.             .Fields.Append .CreateField("lngSortNumber", dbLong)
  21.             .Fields("lngSortNumber").Attributes = dbAutoIncrField
  22.         End If
  23.         .Fields.Append .CreateField("lngReqID", dbLong)
  24.         .Fields.Append .CreateField("txtSectionNumber", dbText, 50)
  25.         .Fields.Append .CreateField("txtType", dbText, 20)
  26.         .Fields.Append .CreateField("txtRevision", dbText, 10)
  27.         .Fields.Append .CreateField("memSpecifikation", dbMemo)
  28.         If bHazards Then
  29.             .Fields.Append .CreateField("Comments", dbMemo)
  30.             .Fields("Comments").AllowZeroLength = True
  31.             .Fields.Append .CreateField("Hazard nr", dbMemo)
  32.             .Fields("Hazard nr").AllowZeroLength = True
  33.             .Fields.Append .CreateField("Hazards", dbMemo)
  34.             .Fields("Hazards").AllowZeroLength = True
  35.         End If
  37.     End With
  39.     tblDef.Fields("txtSectionNumber").AllowZeroLength = True
  40.     ' Append the new TableDef to the database.
  41.         db.TableDefs.Append tblDef
  42. End Sub
Not all of the above code is required, some is specialized for my need, but this gives you an example.
Aug 24 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.