Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append a single record to a table

Status
Not open for further replies.

valmatic

IS-IT--Management
Mar 30, 2006
14
US
HI. I'm trying to create my 1st append query and am having some trouble. I have an append query set to duplicate some record data to a new record in the same table through an on-click event on my form. When I click the button, the query runs but rather than appending the single record, it asks if I want to update all records in the table. Here is my code:

Private Sub TestNextPM_Click()

Dim stDocName As String

stDocName = "QryCreateNextPM"
DoCmd.OpenQuery stDocName, , acAdd

End Sub

How do I append a single record instead of my entire table?

thanks
 
This generally depends on the design of your query. It is quite common to reference a control on the form in the criteria line of the query, for example:

[tt]=Forms![Forms Name].ID[/tt]

You do not need the acAdd argument for an Append query.
 
Can you post the SQL that's in "QryCreateNextPM"?
 
Yay, I got it. I new I was missing something simple. thanks for the tip Remou:) Thanks also for the quick response Golom:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top