If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
populate data from a list to a new table
Hello, i hope someone has answer to this.
i have a list box on a form and from this i am creating a history table. the list box has a row source a query that contains more column then what's showing on the list. how can i append the rest of this column to this new table of history, since i only have couple of items less on the list compared to the query. i could append what i have in the list using this: Dim varItem As Variant Dim prm_sched As Control Dim DBS As Database Dim rst As Recordset Set prm_sched = Me![sched] If prm_sched.ItemsSelected.Count = 0 Then Beep MsgBox "no item selected ", 48 Exit Sub End If Set DBS = CodeDb Set rst = DBS.OpenRecordset("SELECT * FROM POhistory") 'run through all selected items For Each varItem In prm_sched.ItemsSelected rst.AddNew rst!OrderNo = prm_sched.Column(0) rst!RequiredDate = prm_sched.Column(1) rst!CustomerID = prm_sched.Column(2) rst!ModelNumber = prm_sched.Column(3) rst!Description = prm_sched.Column(4) rst!Comment = prm_sched.Column(6) rst!OrderQty = prm_sched.Column(5) rst.update Next but i want to append the rest of the columns in the query that list(sched) row sources from. how can i do that -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200704/1 |
#2
|
|||
|
|||
populate data from a list to a new table
As far as I know, you'll have to add the rest of the query columns to the
listbox in order to do what you want. You can make the columns hidden (width=0") so they don't appear in the listbox display. Carl Rapson "bigwillno2 via AccessMonster.com" u32748@uwe wrote in message news:702829f380f05@uwe... Hello, i hope someone has answer to this. i have a list box on a form and from this i am creating a history table. the list box has a row source a query that contains more column then what's showing on the list. how can i append the rest of this column to this new table of history, since i only have couple of items less on the list compared to the query. i could append what i have in the list using this: Dim varItem As Variant Dim prm_sched As Control Dim DBS As Database Dim rst As Recordset Set prm_sched = Me![sched] If prm_sched.ItemsSelected.Count = 0 Then Beep MsgBox "no item selected ", 48 Exit Sub End If Set DBS = CodeDb Set rst = DBS.OpenRecordset("SELECT * FROM POhistory") 'run through all selected items For Each varItem In prm_sched.ItemsSelected rst.AddNew rst!OrderNo = prm_sched.Column(0) rst!RequiredDate = prm_sched.Column(1) rst!CustomerID = prm_sched.Column(2) rst!ModelNumber = prm_sched.Column(3) rst!Description = prm_sched.Column(4) rst!Comment = prm_sched.Column(6) rst!OrderQty = prm_sched.Column(5) rst.update Next but i want to append the rest of the columns in the query that list(sched) row sources from. how can i do that -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200704/1 |
#3
|
|||
|
|||
populate data from a list to a new table
Hey Carl,
works perfect.......thanks Carl Rapson wrote: As far as I know, you'll have to add the rest of the query columns to the listbox in order to do what you want. You can make the columns hidden (width=0") so they don't appear in the listbox display. Carl Rapson Hello, i hope someone has answer to this. [quoted text clipped - 37 lines] but i want to append the rest of the columns in the query that list(sched) row sources from. how can i do that -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200704/1 |
Thread Tools | |
Display Modes | |
|
|