A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

populate data from a list to a new table



 
 
Thread Tools Display Modes
  #1  
Old April 3rd, 2007, 04:54 PM posted to microsoft.public.access.forms
bigwillno2 via AccessMonster.com
external usenet poster
 
Posts: 39
Default 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  
Old April 4th, 2007, 05:23 PM posted to microsoft.public.access.forms
Carl Rapson
external usenet poster
 
Posts: 517
Default 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  
Old April 4th, 2007, 06:57 PM posted to microsoft.public.access.forms
bigwillno2 via AccessMonster.com
external usenet poster
 
Posts: 39
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.