MS Access Append query

Please support our MS Access and FileMaker Pro advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jun 2008
Posts: 2
Reputation: hikosj is an unknown quantity at this point 
Solved Threads: 0
hikosj hikosj is offline Offline
Newbie Poster

MS Access Append query

 
0
  #1
Jun 6th, 2008
Hi all,

I have a problem with a query in access that I cant seem to figure out. I have a form named frmRecruitment with a subform named sfrmParticipant. At the moment I am using an append query to append records from 'sfrmParticipant' to 'frmIntervention' using a button on a main form 'frmRecruitment'.

This append query appends all the records from
'sfrmParticipant' to 'frmIntervention' but I only want to append the record that is displayed as the current record in the form or the last record from tblParticipant into tblIntervention and by using the button on the form append only that very last record.

I modified the code to do this:
Private Sub Command31_Click()
DoCmd.RunSQL "INSERT into [tblIntervention]([participantID]) VALUES (participantID)"
End Sub

and yes it appends only the information being displayed or the very last record from tblParticipant into tblIntervention but it prompts me to enter the participantID in order to do it.

How do I modify the append query to only append the form record with out promting me and having to enter the participant ID manually?


Thanks for your help!
hikosj
Last edited by hikosj; Jun 6th, 2008 at 2:01 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: hikosj is an unknown quantity at this point 
Solved Threads: 0
hikosj hikosj is offline Offline
Newbie Poster

Re: MS Access Append query

 
0
  #2
Jun 19th, 2008
Thanks evreyone for the "help" and suggestions,

I finally figured it out! It took me a while but I finally got it to work.
I added this to the click event of a button

Dim str As String
 str = Form_frmPresentation.presentationID.Value
 DoCmd.Close
 DoCmd.OpenForm "sfrmAppointmentOne", acNormal, , , , acWindowNormal,
 "Value=" + str


And then I added this to the on load event of the form getting the variable


 Form_frmIntervention.participantID.Value =
 Form_frmParticipant.participantID.Value
 Me.Refresh
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 44
Reputation: boblarson is an unknown quantity at this point 
Solved Threads: 3
boblarson boblarson is offline Offline
Light Poster

Re: MS Access Append query

 
0
  #3
Jun 23rd, 2008
The answer to your original question as to why the query wasn't working is that you never gave it a WHERE clause to limit what it was doing.
Bob Larson, Access MVP
____________________________________
For Quick Tutorials and Samples for Microsoft Access: BTAB Development
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for MS Access and FileMaker Pro
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC