Solved

Visual Basic Append table from Subform

Posted on 2009-06-28
1
375 Views
Last Modified: 2013-11-27
Hello everyone, I am trying to copy and append 3 fields as a new record in the same table from a subform of a subform based on the record the user is on.  

Private Sub plow_Click()
    Dim SQL As String
    SQL = "INSERT INTO [c resources] ( taskid, resacc, resunit )"
    SQL = SQL & "SELECT [c resources].taskid, [c resources].resacc, [c resources].resunit FROM [c resources]"
    SQL = SQL & "WHERE [c resources].resourceid = [forms]![a schedule Query Form Resources and Measures]![sfTasks]![sfResources]![resourceid];"
   
End Sub

Any ideas?
0
Comment
Question by:wellesleydpw
1 Comment
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
Comment Utility
SQL = SQL & "WHERE [c resources].resourceid =" &  [forms]![a schedule Query Form Resources and Measures]![sfTasks].Form![sfResources].Form![resourceid]

Assumes that all your names are correct and that recourceid is a number.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now