Results 1 to 3 of 3

Thread: Opening Access DB with CommonDlg Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Posts
    1

    Post

    I am trying to get an Access database to open using the Microsoft Common Dialog Control.


    Private Sub MnuFileOpen_Click()
    CommonDialog1.ShowOpen


    Data1.Connect = Access
    Data1.DatabaseName = CommonDialog1.FileName
    Data1.Caption = CommonDialog1.FileTitle
    Data1.RecordSource = "table"

    End Sub

    This code doesn't appear to work. When the database is opened, I would hope that it should populate the existing fields on the form. Any help would be appreciated.



  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    try adding :

    data1.refresh


    (after data1.recordsource)

    Note:
    Data1.RecordSource should be set to your table name (if it's Table, thats not wise) or query, if you're trying to set the Recordset type, use the following instead:

    Data1.RecordsetType= 0 ' which is "table"

    [This message has been edited by JHausmann (edited 08-31-1999).]

  3. #3
    New Member
    Join Date
    Jun 1999
    Posts
    3

    Post

    I'm not sure if the code you typed is verbatim out of your app or not, but where you have
    Data1.Connect = Access

    Is Access a string variable that you've assigned a value to? I know that that property is expecting to see a string. If this is your problem, and you haven't declared the Option Explicit keyword, I would suggest you do that because it will catch errors like this.

    Of course if that isn't verbatim and you do have it typed correctly in your code, you can ignore this whole message

    Castor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width