Author Topic: Data from Access file with VBA?  (Read 3755 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
Data from Access file with VBA?
« on: October 29, 2007, 10:52:31 AM »
Hello everybody,

Can i read data from an access dbase into a dialog box in VBA?


Thanks in advance
Bernd
Bernd

MP

  • Seagull
  • Posts: 17496
Re: Data from Access file with VBA?
« Reply #1 on: October 29, 2007, 10:59:11 AM »
Affirmative.












If what you're really asking is "How can I read a database and populate a form's control, be it a list box or a data grid etc." then the answer will be a little more more verbose. On said topic there are about 10 billion resources available on the net. Perhaps we could steer you to some appropriate ones if you provide a little more detail. :)
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
Re: Data from Access file with VBA?
« Reply #2 on: October 29, 2007, 11:42:34 AM »
Michael,

right, i was pretty short and not very specific  :oops:, but that
Quote
"How can I read a database and populate a form's control, be it a list box or a data grid etc."
is what i was looking for. I don;'t do much in VBA but this one needs to be done in VBA since i will have to do part off it out of a xls.


Thanks ,

Bernd

Bernd

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #3 on: October 29, 2007, 01:08:17 PM »
Try this simple example
Just change full name of databse file
and name of the table

~'J'~

Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
Re: Data from Access file with VBA?
« Reply #4 on: October 29, 2007, 03:16:37 PM »
Fatty,

that is cool.

Eh, is there any way to write to the mdb file as well?

Thanks in advance

Bernd
Bernd

Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
Re: Data from Access file with VBA?
« Reply #5 on: October 29, 2007, 03:20:29 PM »
Fatty, can i simply get that code in Excel running, too?

TiA

Bernd
Bernd

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #6 on: October 29, 2007, 04:01:42 PM »
Hi Bernd
Hey, man, two tasks in the same time
is too much for me :lol:
My dim brain is not so quick as you want
I need the time to chew it :)
Still working on examples for you
see ya

~'J'~

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #7 on: October 29, 2007, 04:05:31 PM »
Fatty, can i simply get that code in Excel running, too?

TiA

Bernd
What is your goal?
Do you want to import data to Excel from Access?

~'J'~

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #8 on: October 29, 2007, 05:10:18 PM »
Here is an example how to run the code
from Excel
Change in code full name of database file,
table name and field names
Then just push a button

~'J'~


Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
Re: Data from Access file with VBA?
« Reply #9 on: October 29, 2007, 06:37:49 PM »
Sorry Fatty,

i was out for a while.

I got the first file running in excel with a few changes, funny enough i get an error MSG
Quote
"can't find isam file"

Thanks Bernd
Bernd

Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
Re: Data from Access file with VBA?
« Reply #10 on: October 29, 2007, 06:47:27 PM »
 :oops:Sorry again.,

got it going, my mistake. That is cool, now there is only one question remaining, how can i write back from Excel->Access?

Thanks in Advance

Bernd
Bernd

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #11 on: October 29, 2007, 06:53:08 PM »
Bernd,
Now is too late for this work
I'll try to do it tomorrow

~'J'~

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #12 on: October 30, 2007, 04:23:04 AM »
:oops:Sorry again.,

got it going, my mistake. That is cool, now there is only one question remaining, how can i write back from Excel->Access?

Thanks in Advance

Bernd

Here is edited version
Hth

~'J'~

Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
Re: Data from Access file with VBA?
« Reply #13 on: October 30, 2007, 08:05:03 AM »
Fatty,

I'm on a 9 hour time difference with you right now, so I thought you will read my post in there morning anyway, forgot the Russian work ethic is better than the one in the west :-).

What does
Quote
"Select diapazone to export"

mean?

I obviously get always wrong and get an error :-(


Thanks in advance,

Bernd
Bernd

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #14 on: October 30, 2007, 09:20:57 AM »
Hi Bernd, no worries :wink:

You wrote:
>>I obviously get always wrong and get an error

After the "Refedit window" will appears you
need to select sheet range manualy and then
hit OK button
You will see before in the textbox
an address of selected range

And don't forget about to change file name etc.
Would this helps?

Let me know if you need some other stuff there

~'J'~