|
-
Jan 11th, 2002, 03:59 PM
#1
Thread Starter
Frenzied Member
Slight problem with ListView
Hello Everyone
I'm trying to use ListView to get contents of an Access Table into it...And I use the following code to do so...but while executing the statements I get an error- Invalid property Value
Please help!!!!
Dim Db As Database
Dim Rs As Recordset
Dim SQL As String
Dim MyItem As ListItem
Private Sub Form_Load()
Set Db = OpenDatabase("d:\check\taws\data.mdb")
SQL = "SELECT * FROM Audit "
Set Rs = Db.OpenRecordset(SQL, dbOpenDynaset)
Do While Not Rs.EOF
Set MyItem = ListView1.ListItems.Add(, , Rs(0))
MyItem.SubItems(1) = Rs(0)
MyItem.SubItems(2) = Rs(1)
'continue as above until all fields are accounted for
Rs.MoveNext
Loop
Rs.Close
-
Jan 11th, 2002, 07:21 PM
#2
On what line do you get the error?
-
Jan 11th, 2002, 07:28 PM
#3
Thread Starter
Frenzied Member
On this line Hack, it says Invalid Property value..
MyItem.SubItems(1) = Rs(0)
-
Jan 11th, 2002, 07:32 PM
#4
You have a minor issue here which can be easily fixed.
VB Code:
Set MyItem = ListView1.ListItems.Add(, , Rs(0)) 'rs 0
MyItem.SubItems(1) = Rs(0) ' rs 0
MyItem.SubItems(2) = Rs(1)
'should be
Set MyItem = ListView1.ListItems.Add(, , Rs(0)) rs 0
MyItem.SubItems(1) = Rs(0) rs 1
MyItem.SubItems(2) = Rs(1) rs 2
'etc
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|