General discussion

Locked

VB 6 DAO.Opendatabase not working

By jamesm1 ·
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 conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums