Hi Art
Your loop control variable is i, while the index variable you are using is itm. You should be using .ItemData(i)
This also suggests that you do not have Option Explicit in this module, which is the best way to introduce this kind of bug!
Best wishes,
Graham
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Sunday, 24 December 2017 12:59
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Write all items in a list box to a table
OK Getting closer
For i = 0 To Me.lsteSubFolder.ListCount - 1
rstSubFolder.AddNew
rstSubFolder!SubLevelOneKey = Me.txtSubLevelOneKey
rstSubFolder!SubFolderName = Me.lsteSubFolder.ItemData(itm)
rstSubFolder!CAbinetID = Me.txtCabinetID
rstSubFolder!SL1NextLevel = "No"
rstSubFolder.Update
Next i
This almost works but not quite. If i put 3 items in the list box then its repeating the the first item in the listbox 3 times in the table, so instead of giving me APPLICANT, DATE, COMPANY it is writing APPLICANT,APPLICANT,APPLICANT in the table/
Posted by: "Graham Mandeno" <graham@mandeno.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
Tidak ada komentar:
Posting Komentar