Discussion Locked

VB 6 DAO.Opendatabase not working

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

1 reply

This discussion is closed to new replies.