我想通過公用對話框選擇訪問ACESS文件,用ADO連接!!
cdgOpendb.ShowOpen
strDataFile = cdgOpendb.FileName
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strDataFile & ";Persist Security Info=False"
lbshowmsg.Caption = strConn
Adodc1.ConnectionString = strConn
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "ToolTip"
Text1.DataSource = "Adodc1"
Text1.DataField = "ToolTipID"TEXT1.DATASOURCE老是提示出錯?未找到方法!!
用絕對路徑連接就沒問題咯!!是怎麽回事咯??幫幫忙!!!

解决方案 »

  1.   

    Text1.DataSource = "Adodc1"
    -----------------------------
    缺少Set关键字
    Set Text1.DataSource = "Adodc1"
      

  2.   

    謝啦!可是設了之後又提示找不到ADODC1了??
      

  3.   

    cdgOpendb.ShowOpen
    strDataFile = cdgOpendb.FileName
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strDataFile & ";Persist Security Info=False"
    lbshowmsg.Caption = strConn
    Adodc1.ConnectionString = strConn
    Adodc1.CommandType = adCmdTable
    Adodc1.RecordSource = "ToolTip"Set Text1.DataSource = "Adodc1"   '注意:你少了个Set  :)
    Text1.DataField = "ToolTipID"
      

  4.   

    謝謝兩位!!!!
    能不能幫忙說明一下什麽情况下,哪些屬性一般用SET咯????