Open Connection in a Module

New1

Member
Joined
Dec 5, 2005
Messages
9
Programming Experience
1-3
Hi, :)
does anyone know how can i open a connection in a module with Access?
I want to make OLEDB commands (like Select,Delete...). In a module, i can't create a new Dataset,DataAdapter,OLEDBConnection, as i could in a form (from toolbox)...

Any idea?


Thanx in advance

New1
 
if it's in a module the it will have to be a sub or a function something like...

VB.NET:
Public Sub Connect(ByVal connection As OleDbConnection, ByVal connectionstring As String)
 
connection.connectionstring = connectionstring
 
Try
connection.Open
Catch OpenEx As OleDbException
' Handle error message here
Finally
Connection.close
End Try
End Sub

Additionally : Don't forget to import the system.data.oledb namesapce at the top of your module if you havent already declared it at the project level.
 
Back
Top