'Hi friend!
'I might suggest the use of SQL with ADO to retrieve Data from Databases, that way is much, much better and is more easy to program.
'Ok, let's get back to the matter of this thread man, here's tha snnipet!
Option Explicit
'you have to reference the MS Access 9.0 Object Library
'Let's Declare my object, cus I will soon use it :o)
Dim MyAccess As Access.Application
Private Sub cmdRunQuery_Click()
Set MyAccess = New Access.Application
'Let's Rock and Roll Baby! Here is the code you will love most!
With MyAccess
.OpenCurrentDatabase App.Path & ("\YourDBfile.mdb") 'you decide how to work with your DB
.DoCmd.OpenQuery "YourDBQueryName" 'is here where I set the query name, check the rest of the options in this part
.CloseCurrentDatabase ' I use this after I make the query to run, this is how I do it
End With
Set MyAccess = Nothing 'Let's close this object,
'we don't want to waste memory,huh?
End Sub
'Oki Doki, I hope this can help you, have a nice day!
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement