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

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
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

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
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. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Amsterdammed

  • Guest
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


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

  • Guest
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

Amsterdammed

  • Guest
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

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

  • Guest
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

Amsterdammed

  • Guest
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

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

  • Guest
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

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'~

Amsterdammed

  • Guest
Re: Data from Access file with VBA?
« Reply #15 on: October 30, 2007, 09:49:09 AM »
Fatty,
That works just fine. :-D

I have one little problem left,

the dbase is part of a vertical my company works with. But it is in Access 97 format. Your code requires the latest version (2002) that i have installed an my laptop. So i can manual convert from 97 -> 2002, do the changes with your code, and than convert it back to 97, but i will have to find a way to do this with vba so that the user doesn't have to do it (they will screw up).

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #16 on: October 30, 2007, 12:49:01 PM »
Unfortunately, I don't know how to do it by code :(
Maybe somebody from big lads knows it

~'J'~

Amsterdammed

  • Guest
Re: Data from Access file with VBA?
« Reply #17 on: October 31, 2007, 11:11:22 AM »
Fatty,

you are one of the big lads.  :-)

Thanks for all so far,

Spasiba

Bernd

Fatty

  • Guest
Re: Data from Access file with VBA?
« Reply #18 on: November 01, 2007, 03:13:25 PM »
Sorry for the late
I have been crazy busy with my
own work
You are welcome, Bernd
Glad if that helps

Happy coding :)

~'J'~