Sabtu, 23 Desember 2017

Re: [MS_AccessPros] Re: Write all items in a list box to a table

 

You were correct.

Here is the final code.

For i = 0 To Me.lsteSubFolder.ListCount - 1
    
       rstSubFolder.AddNew
       rstSubFolder!SubLevelOneKey = Format(Now(), "mmddyyhhmmss") & strCurrentUserName & "SUB"
       rstSubFolder!SubFolderName = Me.lsteSubFolder.ItemData(i)
       rstSubFolder!CAbinetID = Me.txtCabinetID
       rstSubFolder!SL1NextLevel = "No"
       rstSubFolder.Update
      
    Next i
 

With Warm Regards,
 
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265  Ext. 130
Fax (605)964-1070

"Valar Dohaeris"







From: "'Graham Mandeno' graham@mandeno.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: MS_Access_Professionals@yahoogroups.com
Sent: Saturday, December 23, 2017 6:05 PM
Subject: RE: [MS_AccessPros] Re: Write all items in a list box to a table

 
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: Art Lorenzini <dbalorenzini@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar