General discussion
October 5, 2006 at 08:30 AM
jamesm1

VB 6 DAO.Opendatabase not working

by jamesm1 . Updated 18 years, 11 months ago

I’m using XP pro ver 2002 SP2 and Office 2003 SP2.

This piece of simple code doesn’t work!

Option Explicit
Dim DB As Database

Private Sub Command1_Click()

CommonDialog1.CancelError = True
CommonDialog1.Filter = “Databases|*.mdb”
CommonDialog1.ShowOpen

If CommonDialog1.FileName <> “” Then
Set DB = OpenDatabase (CommonDialog1.FileName)
Label1.Caption = CommonDialog1.FileName
End If

More code here

END SUB

it works OK until I get to Set DB then it just goes to END SUB, even if I insert = (a known database) instead of <> “” in the If statement

TIA

Michael

This discussion is locked

All Comments