Option Explicit
Private dbprimary As Database
Private rslistdata As Recordset
Private frmmdtref As MDIForm
Public Sub display(dbinput As Database, frmparent As MDIForm, sdatatype As String)
Dim itemreturned As ListItem
Dim fldloop As Field
Dim frmmidref As MDIForm
Dim fnremovespaces
Dim i As Integer
Set dbprimary = dbinput
Set frmmdtref = frmparent
Me.Caption = sdatatype
Set rslistdata = dbprimary.OpenRecordset("qrylist" & fnremovespaces(sdatatype), dbOpenDynaset, dbSeeChanges)
ctrListView.View = lvwReport
ctrListView.Sorted = True
For i = 1 To rslistdata.Fields.Count - 1
ctrListView.ColumnHeaders.Add , "column" & i, rslistdata.Fields(1).Name
Next i
Do While Not rslistdata.EOF
Set itemreturned = ctrListView.ListItems.Add("item" & rslistdata.Fields(0), rslistdata.Fields(1))
For i = 2 To rslistdata.Fields.Count - 1
itemreturned.SubItems(i - 1) = rslistdata.Fields(i) & ""
Next i
rslistdata.MoveNext
Loop
End Sub
Private Function fnremovespaces(sinput As String) As String
Dim stmp As String
Dim i As Integer
For i = 1 To Len(sinput)
If Mid$(sinput, i, 1) <> "" Then
stmp = stmp & Mid$(sinput, i, 1)
End If
Next i
fnremovespaces = stmp
End Function
红色字段里面的黑体字就是真正的错误,fnremovespaces(sdatatype), 说是类型不匹配,可是我看了下他们定义时都是字符型,怎么也 看不出错是什么原因,现在还 只是运行到这里
下面可能 还很多错误还不知道,解决这个问题后,如果后面的错误还不能搞定,也 希望大家能帮我下,我都在这里面问,希望高手能帮我。