Question : VB code in Ms Access - connection

Hello,

I doing with MS access.I have table, forms...Now I want to write code in VB (MS acces), when form load, I want to get information from table, but I dont now how to make connection to table and I want to do with recordset.

Thanks

Answer : VB code in Ms Access - connection

if you are using Access 2000 or newer, then use code like this:

this goes in the General Declarations area for the form, not in any specific subprocedure.
Dim rst As Recordset
Dim Conn as Connection

Private Sub Form_Load(Cancel As Integer)

Set Conn = CurrentProject.Connection

Set rst = new Recordset
rs.Open  "SELECT * FROM MyTable", conn

End Sub

AW
Random Solutions  
 
programming4us programming4us