A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

VB to Access via DDE



 
 
Thread Tools Display Modes
  #1  
Old July 31st, 2006, 04:41 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Jonathan
external usenet poster
 
Posts: 13
Default VB to Access via DDE

Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan


  #2  
Old July 31st, 2006, 05:03 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Graham R Seach
external usenet poster
 
Posts: 261
Default VB to Access via DDE

Jonathan,

Yes, the process is called "automation". The following is referred to as
"early binding". It is the easiest, and most functional because it gives you
access to Intellisense, but it is version-dependent. If you want version
independence, you have to use "late binding".

Add a reference to the Access type library

Dim acc As Access.Application
Dim db As DAO.Database

Set acc = New Access.Application
acc.OpenCurrentDatabase "path to database.mdb"
Set db = acc.CurrentDb

acc.Forms!frmMyForm!txtSomeTextbox = "abc"

acc.Quit acQuitSaveNone
acc.CloseCurrentDatabase
Set db = Nothing
Set acc = Nothing

To use "late binding"...
Dim acc As Object
Dim db As DAO.Database

Set acc = CreateObject("Access.Application")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan




  #3  
Old July 31st, 2006, 05:11 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Jonathan
external usenet poster
 
Posts: 13
Default VB to Access via DDE

Graham
This looks good. Can you navigate menu bars and click buttons this way?

Jonathan

"Graham R Seach" wrote in message
...
Jonathan,

Yes, the process is called "automation". The following is referred to as
"early binding". It is the easiest, and most functional because it gives
you access to Intellisense, but it is version-dependent. If you want
version independence, you have to use "late binding".

Add a reference to the Access type library

Dim acc As Access.Application
Dim db As DAO.Database

Set acc = New Access.Application
acc.OpenCurrentDatabase "path to database.mdb"
Set db = acc.CurrentDb

acc.Forms!frmMyForm!txtSomeTextbox = "abc"

acc.Quit acQuitSaveNone
acc.CloseCurrentDatabase
Set db = Nothing
Set acc = Nothing

To use "late binding"...
Dim acc As Object
Dim db As DAO.Database

Set acc = CreateObject("Access.Application")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan






  #4  
Old July 31st, 2006, 05:20 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Terry Kreft
external usenet poster
 
Posts: 213
Default VB to Access via DDE

Yes you can use Access as a DDE server but why would you want to(?) when you
can use OLE automation which is much easier.

Have a look at the url below for DDE stuff:-
http://msdn.microsoft.com/library/de...HV05186349.asp



--

Terry Kreft


"Jonathan" wrote in message
...
Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan




  #5  
Old July 31st, 2006, 05:22 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Graham R Seach
external usenet poster
 
Posts: 261
Default VB to Access via DDE

Jonathan,

Once you get at the Access application object, you can do anything you want.
Just preface everything with acc (if that's what your Access application
object is called).

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Graham
This looks good. Can you navigate menu bars and click buttons this way?

Jonathan

"Graham R Seach" wrote in message
...
Jonathan,

Yes, the process is called "automation". The following is referred to as
"early binding". It is the easiest, and most functional because it gives
you access to Intellisense, but it is version-dependent. If you want
version independence, you have to use "late binding".

Add a reference to the Access type library

Dim acc As Access.Application
Dim db As DAO.Database

Set acc = New Access.Application
acc.OpenCurrentDatabase "path to database.mdb"
Set db = acc.CurrentDb

acc.Forms!frmMyForm!txtSomeTextbox = "abc"

acc.Quit acQuitSaveNone
acc.CloseCurrentDatabase
Set db = Nothing
Set acc = Nothing

To use "late binding"...
Dim acc As Object
Dim db As DAO.Database

Set acc = CreateObject("Access.Application")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan








  #6  
Old July 31st, 2006, 05:42 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Ralph
external usenet poster
 
Posts: 27
Default VB to Access via DDE


"Jonathan" wrote in message
...
Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan


Yes.

There are plenty of examples in both the VB and MSAccess help files. Lookup
"dde functions poke".

Note: not all examples will be specific to MSAccess, (usually Excel), but
they will work with any application that supports DDE.

-ralph


  #7  
Old July 31st, 2006, 06:30 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Jonathan
external usenet poster
 
Posts: 13
Default VB to Access via DDE

Maybe I'm missing something obvious but what combination of commands do you
use to click a button on a form??

Also I found that I had to execute acc!DoCmd.OpenForm "Form1" before I could
but anything in a text box.

Jonathan

"Graham R Seach" wrote in message
...
Jonathan,

Once you get at the Access application object, you can do anything you

want.
Just preface everything with acc (if that's what your Access application
object is called).

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Graham
This looks good. Can you navigate menu bars and click buttons this way?

Jonathan

"Graham R Seach" wrote in message
...
Jonathan,

Yes, the process is called "automation". The following is referred to

as
"early binding". It is the easiest, and most functional because it

gives
you access to Intellisense, but it is version-dependent. If you want
version independence, you have to use "late binding".

Add a reference to the Access type library

Dim acc As Access.Application
Dim db As DAO.Database

Set acc = New Access.Application
acc.OpenCurrentDatabase "path to database.mdb"
Set db = acc.CurrentDb

acc.Forms!frmMyForm!txtSomeTextbox = "abc"

acc.Quit acQuitSaveNone
acc.CloseCurrentDatabase
Set db = Nothing
Set acc = Nothing

To use "late binding"...
Dim acc As Object
Dim db As DAO.Database

Set acc = CreateObject("Access.Application")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan










  #8  
Old July 31st, 2006, 07:03 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default VB to Access via DDE

You don't click the button: you call the procedure (or macro) that's defined
for the click event. Assuming the button is named MyButton, you'd do
something like:

Call acc.Forms("Form1").MyButton_Click

Note that this requires that you change the declaration from Private Sub
MyButton_Click() to Public Sub MyButton_Click().


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Jonathan" wrote in message
...
Maybe I'm missing something obvious but what combination of commands do
you
use to click a button on a form??

Also I found that I had to execute acc!DoCmd.OpenForm "Form1" before I
could
but anything in a text box.

Jonathan

"Graham R Seach" wrote in message
...
Jonathan,

Once you get at the Access application object, you can do anything you

want.
Just preface everything with acc (if that's what your Access application
object is called).

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Graham
This looks good. Can you navigate menu bars and click buttons this way?

Jonathan

"Graham R Seach" wrote in message
...
Jonathan,

Yes, the process is called "automation". The following is referred to

as
"early binding". It is the easiest, and most functional because it

gives
you access to Intellisense, but it is version-dependent. If you want
version independence, you have to use "late binding".

Add a reference to the Access type library

Dim acc As Access.Application
Dim db As DAO.Database

Set acc = New Access.Application
acc.OpenCurrentDatabase "path to database.mdb"
Set db = acc.CurrentDb

acc.Forms!frmMyForm!txtSomeTextbox = "abc"

acc.Quit acQuitSaveNone
acc.CloseCurrentDatabase
Set db = Nothing
Set acc = Nothing

To use "late binding"...
Dim acc As Object
Dim db As DAO.Database

Set acc = CreateObject("Access.Application")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to
Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan












  #9  
Old July 31st, 2006, 07:37 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Jonathan
external usenet poster
 
Posts: 13
Default VB to Access via DDE

Duhh! Thanks Doug!

Jonathan


"Douglas J. Steele" wrote in message
...
You don't click the button: you call the procedure (or macro) that's

defined
for the click event. Assuming the button is named MyButton, you'd do
something like:

Call acc.Forms("Form1").MyButton_Click

Note that this requires that you change the declaration from Private Sub
MyButton_Click() to Public Sub MyButton_Click().


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Jonathan" wrote in message
...
Maybe I'm missing something obvious but what combination of commands do
you
use to click a button on a form??

Also I found that I had to execute acc!DoCmd.OpenForm "Form1" before I
could
but anything in a text box.

Jonathan

"Graham R Seach" wrote in message
...
Jonathan,

Once you get at the Access application object, you can do anything you

want.
Just preface everything with acc (if that's what your Access

application
object is called).

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Graham
This looks good. Can you navigate menu bars and click buttons this

way?

Jonathan

"Graham R Seach" wrote in message
...
Jonathan,

Yes, the process is called "automation". The following is referred

to
as
"early binding". It is the easiest, and most functional because it

gives
you access to Intellisense, but it is version-dependent. If you want
version independence, you have to use "late binding".

Add a reference to the Access type library

Dim acc As Access.Application
Dim db As DAO.Database

Set acc = New Access.Application
acc.OpenCurrentDatabase "path to database.mdb"
Set db = acc.CurrentDb

acc.Forms!frmMyForm!txtSomeTextbox = "abc"

acc.Quit acQuitSaveNone
acc.CloseCurrentDatabase
Set db = Nothing
Set acc = Nothing

To use "late binding"...
Dim acc As Object
Dim db As DAO.Database

Set acc = CreateObject("Access.Application")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

"Jonathan" wrote in message
...
Hello all,

Is there any way for a VB application to communicate with an Access
application via DDE? I want to be able to send text box data to
Access
forms, click buttons and menu bars from an external application.



Thanks in advance,

Jonathan














  #10  
Old July 31st, 2006, 07:48 PM posted to microsoft.public.access,microsoft.public.vb.general.discussion
Larry Serflaten
external usenet poster
 
Posts: 4
Default VB to Access via DDE


"Douglas J. Steele" wrote
You don't click the button: you call the procedure (or macro) that's defined
for the click event. Assuming the button is named MyButton, you'd do
something like:

Call acc.Forms("Form1").MyButton_Click

Note that this requires that you change the declaration from Private Sub
MyButton_Click() to Public Sub MyButton_Click().



In pure VB:

Form1.MyButton.Value = True

That command will cause the click event to execute. How does that
fare in Access? Using the appropreate syntax for Access, would it
have a similar effect? (No change to Public event needed....)

LFS


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.