請教各位先進:
小弟欲選擇開啟Access資料庫中的兩個資料表?
部分程式碼如下:
Private Sub cmdsure_Click()
strtable = cmbtable.Text
frm學生資料表.Show
Unload Me
End Sub
Private Sub Form1_Load()
cmbtable.Text = "四工三"
cmbtable.AddItem "四工三", 0
cmbtable.AddItem "四工二", 1
End Sub
............................................................
Private Sub frm學生資料表_Load()
Dim db As Connection, strtable As String
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DataSource=App.Path & \..\IE.mdb"
Set adoPrimaryRS = New Recordset
'Select Case strtable
'Case "四工三"
adoPrimaryRS.Open "select 學號,姓名,生日,家裡電話,連絡電話 from 四工三學生資料表 Order by 學號", db, adOpenStatic, adLockOptimistic
'Case "四工二"
'adoPrimaryRS.Open "select 學號,姓名,生日,家裡電話,連絡電話 from 四工二學生資料表 Order by 學號", db, adOpenStatic, adLockOptimistic
'End Select
....
End Sub
但上述於執行時,卻出現"物件關閉"的情形......敬請各位來信指教