|
Thread: mdb
-
Nov 3rd, 2002, 01:58 PM
#1
Thread Starter
Fanatic Member
mdb
Greetings,
If I want to bring up a browse dialog box where only .mdb files are available for selection, what do I need to say. Better yet, is there any code anyone can send me so I can paste it in and try it out?
The even to call it will be a button click called cmdAccess.
Obviously, the idea is that when they click on the button, they can browse for a Microsoft Access Database.
Thank you,
Jim
-
Nov 3rd, 2002, 02:07 PM
#2
Thread Starter
Fanatic Member
Alright, alright, just to show I'm not being a total mooch with that last question, I have this so far, below. How do I make it so that it defaults to mdb type files, or better yet, how do I make so that ONLY mdb files can be presented?
Thank you,
Jim
Private Sub cmdAccess_Click()
Dim sAnswer As String
Dim filename As String
Dim F As Integer
CommonDialog1.ShowOpen
filename = CommonDialog1.filename
F = FreeFile
If filename <> "" And Len(Dir(filename)) <> 0 Then
Open filename For Input As #F
'txtFile.Text = Input$(LOF(F), F)
txtFile.Text = filename
Close #F
End If
End Sub
-
Nov 3rd, 2002, 02:11 PM
#3
Frenzied Member
VB Code:
Private Sub cmdAccess_Click()
'Need this in case user clicks cancel
On Error GoTo cdlg_err
'Setup the common dialog control and show the open file dialog
With CommonDialog1
.DialogTitle = "Microsoft Access Files"
.DefaultExt = ".mdb"
.Filter = "Microsoft Access Files|*.mdb"
.ShowOpen
End With
Exit Sub
cdlg_err:
'Check to see if the cancel button generated the error,
'if not, show the error message
If Err.Number <> cdlCancel Then
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description
End If
Exit Sub
End Sub
-
Nov 3rd, 2002, 02:17 PM
#4
Thread Starter
Fanatic Member
You are THEE man!!!! (assuming you are indeed a man. Just can't picture a woman putting that for her picture.)
Thanks again!!!
Jim
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|