回复:(山嘉阿黛儿)关于VB与ACCESS连接的一个实例问...
这是我刚编的一点儿
Private Sub Command1_Click()
CommonDialog1.DialogTitle = "打开文件" '对话框的标题
CommonDialog1.Filter = "text files(*.txt)|*.txt|all files(*.*)|(*.*)" '过滤器
CommonDialog1.InitDir = 0 '默认的文件夹
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
Private Sub Command2_Click()
Dim temp As String
Dim s1 As String '存储MD记录
Dim s2 As String '存储YL记录
Open CommonDialog1.FileName For Input As #1
Do While Not EOF(1)
Line Input #1, temp
Dim sLine As String
Dim sItem() As String
Dim a As String, b As String
sLine = temp
sItem = Split(sLine, ",")
sItem(0) =
sItem(2) =
sItem(3) =
sItem(4) =
sItem(5) =
sItem(6) =
sItem(7) = 我不知道这后面应该等于什么
a = Left(sItem(6), 2) '此时a = "MD"
b = Mid(sItem(6), 3) '此时b = "5A"
End Sub
Private Sub Command3_Click()
Unload Me
End Sub