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!

How to copy true/false field in a table?

Status
Not open for further replies.
Mar 27, 2002
168
NL
I have a simple duplicate procedure
The Idea is: first copy all values of a form to a TempTable
Then change the name of the product
Then put the values into the product table
Drop the temptable
Problem: there are true/false field (2meter,4meter,afwijk_baan, tegel, afwijk_tegel)
how to copy these values back into the table?
See the procedure below,
thanx in advance
gerard

strSQL = "SELECT STALEN_tblProduct.pr_beschrijving, STALEN_tblProduct.aantal_stalen, " & _
"STALEN_tblProduct.CP_ID, STALEN_tblProduct.MP_Id, STALEN_tblProduct.pr_code, " & _
"STALEN_tblProduct.[2meter], STALEN_tblProduct.[4meter], STALEN_tblProduct.tegel, " & _
"STALEN_tblProduct.afwijk_baan, STALEN_tblProduct.afwijk_tegel, STALEN_tblProduct.bijzonderheid" & _
" INTO STALEN_DuplicateStaal FROM STALEN_tblProduct WHERE product_id = " & TempProductID
DoCmd.RunSQL strSQL

strSQL = "UPDATE STALEN_DuplicateStaal " & _
"SET pr_beschrijving = '" & InputBox("Geef naam staal", "Dupliceer staal") & "'"
DoCmd.RunSQL strSQL

strSQL = "INSERT INTO STALEN_tblProduct SELECT * FROM STALEN_DuplicateStaal"
DoCmd.RunSQL strSQL
strSQL = "DROP Table STALEN_DuplicateStaal"
DoCmd.RunSQL strSQL
 
Why not an UPDATE query to change the product name? Just run the InputBox first, save the returned value in a variable & drop it into the query.

"UPDATE STALEN_tblProduct " _
& "SET pr_beschrijving = '" & varInputReturn & "' " _
& "WHERE product_id = '" & TempProductID & "'"

That way (unless it's required for another reason), you don't need the temp table at all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top