Inserting IDs into a list box using ItemData function
From: Evan (evandelagrammaticas_at_hotmail.com)
Date: 10/06/04
- Next message: diamondpony: "Calendar..."
- Previous message: Jay Freedman: "Re: AddTextBox Method - want to anchor it elsewhere in code."
- Next in thread: Doug Robbins: "Re: Inserting IDs into a list box using ItemData function"
- Reply: Doug Robbins: "Re: Inserting IDs into a list box using ItemData function"
- Messages sorted by: [ date ] [ thread ]
Date: 5 Oct 2004 21:43:54 -0700
Hi guys, I am sorry for the cross-post but I am experiencing a problem
that I just cant seem to sort out and I am beginning to think that for
something as simple as this - there may be no solution.
CURRENT SITUATION:
I have a database with 2 tables in it... the first table is users
(userID, userName) the second table is notes (noteID, userID, notes).
I have managed to populate a list box in a userform (MSWord) with all
the userNames from the user table. I would like to link the user names
to the userID's so I will be able to locate all the notes related to a
specific user from the notes table. The crux of the current code WHICH
WORKS looks like this...
Do While Not rec.EOF
With lstCategories
.AddItem rec("categoryName")
End With
rec.MoveNext
Loop
PROBLEM:
I have done a lot of research and found a function called ItemData
which is supposed to assist me in doing this. According to my research
(which my be applicable to VB only), the solution would look similar
to this:
Do While Not rec.EOF
With lstCategories
.AddItem rec("categoryName")
.ItemData(.NewIndex) = rec("categoryID") //NEW CODE - NOT
WORKING
End With
rec.MoveNext
Loop
When I execute the code above, I get an error - "Compile Error: Method
or data member not found", it then it proceeds to highlight the
.NewIndex function, even though I belive the error is with the
.ItemData function as that does not seem to be avaliable ?!?!
If there is anyone out there that can help me with this problem I
would greatly appreciate it.
Regards,
Evan
- Next message: diamondpony: "Calendar..."
- Previous message: Jay Freedman: "Re: AddTextBox Method - want to anchor it elsewhere in code."
- Next in thread: Doug Robbins: "Re: Inserting IDs into a list box using ItemData function"
- Reply: Doug Robbins: "Re: Inserting IDs into a list box using ItemData function"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|