MS Access to VB program (or Excel) using VB code

  Charence 00:35 26 Jun 04


At the moment all I have managed is to open a database using Visual Basic code, but not extract data from it.

Could anybody please tell me what VB code I would need to open a database and place it in a program I have written?



  AccessMoron 13:07 26 Jun 04

what version of access, VB or Excel are u using?

  Charence 19:16 26 Jun 04

Access 2002, VB6, Excel 2002

Cheers, Charence

  Charence 23:38 26 Jun 04

I have managed to open the database using VB but cannot extract data from it. Any ideas?

Here's the code that opens it

Dim db As Object

Private Sub Workbook_Open()

Set db=GetObject("database.mdb")



  Charence 12:37 29 Jun 04

any ideas anybody?


  Charence 18:22 29 Jun 04

Question Rephrased


What Visual Basic Code would I need to write in order to view data in tables within Access Database?



  VoG II 18:26 29 Jun 04

Does click here help?

  AccessMoron 23:36 03 Jul 04

put the microsoft ADO data control onto the form, right click its properties (this will get u the connection string)

then in the code window you need the following

code that follows has not been tested. nut its somewhere pretty close.

dim DB as adodb.database
dim RS as adodb.recordset

set db = new adodb.database
db.connectionstring = {get this from the ado control}

set rs = new adodb.recordset
rs.activeconnection = db {SQL string}

if not rs.eof and not rs.bof then
msgbox rs.fields("myFieldName").value
end if

This thread is now locked and can not be replied to.

Nintendo Switch review: Hands-on with the intuitive modular console and its disappointing games…

1995-2015: How technology has changed the world in 20 years

Prehistoric Britain is laid out in these Royal Mail stamp illustrations

Best running headphones | Best sport & fitness headphones: 4 brilliant pairs of wireless…