16787 Using a record set in an append query
Sign Up |  Live StatsLive Stats    Articles 37,335| Comments 177,297| Members 19,418, Newest Ssimran| Online 551
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags
Sikh Philosophy Network » Sikh Philosophy Network » Current News » Information Technology » Using a record set in an append query

Using a record set in an append query

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Update or Append query help B Miller Information Technology 3 28-Jul-2006 08:34 AM
Update or Append Query help Adam Information Technology 7 28-Jul-2006 08:33 AM
Delete and append a record from one table to another Luis Pereira Information Technology 1 28-Jul-2006 08:22 AM
Re: Append Query question! Mark Cline Information Technology 2 28-Jul-2006 08:17 AM
append query salmonella Information Technology 0 01-Nov-2005 13:40 PM


Tags
using, record, set, append, query
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:31 AM
rg's Avatar rg
Guest
 
Posts: n/a
   
   
Using a record set in an append query

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
I read an excelent article on append queries
(http://office.microsoft.com/en-au/as...860631033.aspx) and I want
to use an append query to create records from user choices on a form. The
form has 2 subforms with information from 2 different tables. I want to
create new records in a third table from this form. One subform allows the
user to filter students so that they have the group they want to assign tasks
to. The other subform has the tasks that are to be assigned. The table
containing the tasks is a temporary table that holds just the tasks the user
has picked.

I want to create a record that has the student's ID from the first table and
the task from the second table. I want one record for each student/task
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/12775-using-a-record-set-append-query.html
combination. There may be any number of students and up to 3 tasks.

How can I make the append query pick the students that are in the recordset
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12775
the user has filtered to make the new records?
-rg


Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:32 AM
Pieter Wijnen's Avatar Pieter Wijnen
Guest
 
Posts: n/a
   
   
Re: Using a record set in an append query

Pretty simple

Sub Apply_click()
Dim RsSF1 AS DAO.Recordset
Dim RsFS2 As DAO.Recordset
Dim Db AS DAO.Database
Dim QDef AS DAO.QueryDef

Set Db = Access.Currentdb
Set QDef = Db.CreateQueryDef(VBA.vbNullString)
QDef.SQL="PARAMETERS p1 Long, p2 long;"; & VBA.vbCrlf & _
"INSERT INTO TABLE3 (SF1, SF2) VALUES(p1, p2)

Set RsFs1 = Me.SF1.Form.Recordsetclone 'substitute SFx
Set RsFs2 = Me.SF2.Form.Recordsetclone
RsFs1.MoveFirst

While Not RsFs1.EOF
Qdef.Parameters("p1").value = RsF1.Fields(0).Value ' Assuming First
field of the recordsource holds the value
RsFs2.Movefirst
While Not Rsf2.EOF
Qdef.Parameters("p2").value = RsF2.Fields(0).Value ' Assuming First
field of the recordsource holds the value
QDef.Execute DAO.dbSeeChanges
Wend
Wend
' object cleanup recommended

Hope this gets you on the track

Pieter



"rg" wrote in message
news:CBC35725-07F3-4FC2-9D81-1053D5BDBAC2@microsoft.com...
>I read an excelent article on append queries
> (http://office.microsoft.com/en-au/as...860631033.aspx) and I
> want
> to use an append query to create records from user choices on a form. The
> form has 2 subforms with information from 2 different tables. I want to
> create new records in a third table from this form. One subform allows
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12775
> the
> user to filter students so that they have the group they want to assign
> tasks
> to. The other subform has the tasks that are to be assigned. The table
> containing the tasks is a temporary table that holds just the tasks the
> user
> has picked.
>
> I want to create a record that has the student's ID from the first table
> and
> the task from the second table. I want one record for each student/task
> combination. There may be any number of students and up to 3 tasks.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12775
>
> How can I make the append query pick the students that are in the
> recordset
> the user has filtered to make the new records?
> -rg



Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:32 AM
Pieter Wijnen's Avatar Pieter Wijnen
Guest
 
Posts: n/a
   
   
Re: Using a record set in an append query

Pretty simple

Sub Apply_click()
Dim RsSF1 AS DAO.Recordset
Dim RsFS2 As DAO.Recordset
Dim Db AS DAO.Database
Dim QDef AS DAO.QueryDef

Set Db = Access.Currentdb
Set QDef = Db.CreateQueryDef(VBA.vbNullString)
QDef.SQL="PARAMETERS p1 Long, p2 long;"; & VBA.vbCrlf & _
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12775
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12775
"INSERT INTO TABLE3 (SF1, SF2) VALUES(p1, p2)

Set RsFs1 = Me.SF1.Form.Recordsetclone 'substitute SFx
Set RsFs2 = Me.SF2.Form.Recordsetclone
RsFs1.MoveFirst

While Not RsFs1.EOF
Qdef.Parameters("p1").value = RsF1.Fields(0).Value ' Assuming First
field of the recordsource holds the value
RsFs2.Movefirst
While Not Rsf2.EOF
Qdef.Parameters("p2").value = RsF2.Fields(0).Value ' Assuming First
field of the recordsource holds the value
QDef.Execute DAO.dbSeeChanges
Wend
Wend
' object cleanup recommended

Hope this gets you on the track

Pieter



"rg" wrote in message
news:CBC35725-07F3-4FC2-9D81-1053D5BDBAC2@microsoft.com...
>I read an excelent article on append queries
> (http://office.microsoft.com/en-au/as...860631033.aspx) and I
> want
> to use an append query to create records from user choices on a form. The
> form has 2 subforms with information from 2 different tables. I want to
> create new records in a third table from this form. One subform allows
> the
> user to filter students so that they have the group they want to assign
> tasks
> to. The other subform has the tasks that are to be assigned. The table
> containing the tasks is a temporary table that holds just the tasks the
> user
> has picked.
>
> I want to create a record that has the student's ID from the first table
> and
> the task from the second table. I want one record for each student/task
> combination. There may be any number of students and up to 3 tasks.
>
> How can I make the append query pick the students that are in the
> recordset
> the user has filtered to make the new records?
> -rg




--
----------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4182 spam emails to date.
Paying users do not have this message in their emails.
Get the free SPAMfighter here: http://www.spamfighter.com/len


Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:32 AM
rg's Avatar rg
Guest
 
Posts: n/a
   
   
Re: Using a record set in an append query

  Donate Today!  
Pieter,
I'm trying to understand what you've written, and I think I get most of it.
However, I don't see where this steps through the records in the recordset.
Also, is it inserting the records one at a time, or building the append query
to insert all of them at the same time. Sorry, I'm really new to Access and
I"m trying to get up to speeed. Thanks for you help.
-rg

"Pieter Wijnen" wrote:

> Pretty simple
>
> Sub Apply_click()
> Dim RsSF1 AS DAO.Recordset
> Dim RsFS2 As DAO.Recordset
> Dim Db AS DAO.Database
> Dim QDef AS DAO.QueryDef
>
> Set Db = Access.Currentdb
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12775
> Set QDef = Db.CreateQueryDef(VBA.vbNullString)
> QDef.SQL="PARAMETERS p1 Long, p2 long;"; & VBA.vbCrlf & _
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12775
> "INSERT INTO TABLE3 (SF1, SF2) VALUES(p1, p2)
>
> Set RsFs1 = Me.SF1.Form.Recordsetclone 'substitute SFx
> Set RsFs2 = Me.SF2.Form.Recordsetclone
> RsFs1.MoveFirst
>
> While Not RsFs1.EOF
> Qdef.Parameters("p1").value = RsF1.Fields(0).Value ' Assuming First
> field of the recordsource holds the value
> RsFs2.Movefirst
> While Not Rsf2.EOF
> Qdef.Parameters("p2").value = RsF2.Fields(0).Value ' Assuming First
> field of the recordsource holds the value
> QDef.Execute DAO.dbSeeChanges
> Wend
> Wend
> ' object cleanup recommended
>
> Hope this gets you on the track
>
> Pieter
>
>


Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Request for assistance...
Today 09:34 AM
10 Replies, 121 Views
Occultism - Rejection in...
Today 08:44 AM
62 Replies, 2,631 Views
‘Bigoted’ Facebook...
Today 08:32 AM
1 Replies, 35 Views
Australia mulls allowing...
Today 07:30 AM
0 Replies, 23 Views
Woolwich Killing: The...
Today 06:41 AM
3 Replies, 68 Views
Panjabi
By Ishna
Today 04:40 AM
16 Replies, 312 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 03:09 AM
316 Replies, 7,640 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 03:00 AM
179 Replies, 4,541 Views
How does Sikhi help you...
Today 00:52 AM
31 Replies, 982 Views
Transgenderism ... Right...
By Kaylee
Today 00:33 AM
25 Replies, 1,267 Views
Losing My Religion: Why...
Today 00:00 AM
14 Replies, 392 Views
Kirtan
Yesterday 21:24 PM
0 Replies, 38 Views
Keeping Amrit Vela
Yesterday 16:49 PM
12 Replies, 938 Views
Do you believe in...
Yesterday 15:08 PM
196 Replies, 4,108 Views
Black Sikhs?
Yesterday 06:33 AM
20 Replies, 5,910 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 10:29 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.66513 seconds with 32 queries
0