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

how to extract data from first access table and use it another vba application

P: 30
i want to extract data from 1st access table and use that data in another access vba application .


how to do data extraction????
please sujjest me some sample vba code for data extraction
Aug 7 '12 #1
Share this Question
Share on Google+
5 Replies


Rabbit
Expert Mod 10K+
P: 12,327
Is this a VB or VBA question? They are not the same and you are probably posting in the wrong forum.
Aug 7 '12 #2

kadghar
Expert 100+
P: 1,295
Of course its VBA, Rabbit.

Anyway, if your Access DB is an MDB, then you can do this:
1) Make sure you add this reference to your VBA project:
Microsoft DAO Object Library.

2) Use a DataBase object and a Recordset; something like:
Expand|Select|Wrap|Line Numbers
  1. Dim DBobj As Database
  2. Dim RSet As Recordset
  3. Set DBobj = DBEngine.Workspaces(0).OpenDatabase(yourfile.mdb)
  4. Set RSet = DBobj.OpenRecordset("SELECT * FROM table WHERE...")
  5. While not RSet.EOF
  6.     MsgBox RSet("anyField")
  7.     'do something else
  8.     RSet.MoveNext
  9. Wend
  10.  
Aug 8 '12 #3

P: 30
hello i am using access 2007 accdb database.

what will be same code for access 2007 accdb.
Aug 8 '12 #4

kadghar
Expert 100+
P: 1,295
Mmm, I'm not sure; but you can always save as MDB
Aug 8 '12 #5

zmbd
Expert Mod 5K+
P: 5,287
Yes the code will be basiclly the same...
make sure to use the correct file name.
-z
Aug 8 '12 #6

Post your reply

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