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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An SQL query to move record from one tabe to another 1

Status
Not open for further replies.

jbivin

Programmer
Mar 31, 2010
23
US
I am building a database to keep track of orders requested from our warehouse. I have most of it built, but am having trouble building the query below:

Private Sub cmdDisplay1_Click()

Dim strSQL As String

strSQL = "SELECT * FROM tblPending WHERE PartNumber = '&lblPN1.Caption&' INSERT INTO tblFinished"

DoCmd.RunSQL strSQL

End Sub

I am wanting to pull in the value lblPN1.Caption and let the query use it to find the value in tblPending and move it to tblFinished. Thanks for any help.
 
PErhaps this ?
Code:
strSQL = "INSERT INTO tblFinished SELECT * FROM tblPending WHERE PartNumber = '" & Me!lblPN1.Caption & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 

Rather than 2 tables with identical structure, you might want to consider adding a STATUS field to your "Pending" table. You would then be able to perform queries on all the data from one table, simply by including the status field in your WHERE clause.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top