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

Insert Into query in more fields

Status
Not open for further replies.

Cosmiccradle

Technical User
Mar 24, 2003
63
NL
I'm trying to find a way to include all nine Branch libraries instead of just the one Betondorp to take up a new title plus the rest of the information remains the same for all libraries. The Insert Into only gives me the one Library (Betondorp)with the rest of the information. Any ideas?

Thanks Cosmiccradle

INSERT INTO Branchlibraries ( Library, Code, Title, Booknr, Cost, Youth, Adult, Comment, Basislistnr
SELECT 'Betondorp' AS Library, 'w' AS Code, 'Try Again' AS Title, '422.22' AS Booknr, ' 45,00' AS Cost, 'P' AS Youth, ' ' AS Adult, 'ipv Bobbo' AS Comment, '1 ' AS Basislistnr;
 
cosmic,
Here's a thought (if I'm understanding your problem)

dim strLib as variant
dim intPtr as integer
strLib = Array("Betondorp","Dresden","Frankfort"...whatever)

For intPtr = 0 to 8
INSERT INTO Branchlibraries ( Library, Code, Title, Booknr, Cost, Youth, Adult, Comment, Basislistnr
SELECT strLib(intPtr) AS Library, 'w' AS Code, 'Try Again' AS Title, '422.22' AS Booknr, ' 45,00' AS Cost, 'P' AS Youth, ' ' AS Adult, 'ipv Bobbo' AS Comment, '1 ' AS Basislistnr;
Next

I'm not sure if that was what you were asking, or not???

Tranman
 
Hi Tranman:

Thanks for taking the time to answer, however I already got the below answer from someone else and it works fine. Thanks for your time.

INSERT INTO SmallBranchlibraries ( Branch, BookCode, Title, Bookcode, Price, Youth, Adult, Comment, Basislistnr )

SELECT Basisnr.Branch AS Branch, 'w' AS Code, 'Try Again' AS Title, '422.22' AS Bookcode, ' 45,00' AS Price, 'P' AS Youth, ' ' AS Adult, 'ipv Bobbo' AS Comment, ' ' AS Basislistnr
FROM Basisnr
WHERE Basis = (1);

Cosmiccradle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top