View Single Post
  #21  
Old 05-05-2009
chris_dono chris_dono is offline
oOple Advertiser
 
Join Date: Dec 2007
Location: Kent
Posts: 548
Default

Here's one way to do it:
Create a module and paste the following:

Code:
 
Sub CreateRecs()
DoCmd.RunSQL "INSERT INTO STAFF (STAFFID, FIRSTNAME, LASTNAME, TEAM, JOINDATE, WAGEPERHOUR, AMBID) " & _
"VALUES('S01','Steve','Carrow', 1,'14-Apr-1980', 12.54,'A01')"
DoCmd.RunSQL "INSERT INTO STAFF (STAFFID, FIRSTNAME, LASTNAME, TEAM, JOINDATE, WAGEPERHOUR, AMBID) " & _
"VALUES('S02','John','Parry', 3,'23-Mar-1999', 9.44,'A02')"
DoCmd.RunSQL "INSERT INTO STAFF (STAFFID, FIRSTNAME, LASTNAME, TEAM, JOINDATE, WAGEPERHOUR, AMBID) " & _
"VALUES('S03','Hannah','Jones', 7,'12-Dec-2006', 10.38,'A03')"
End Sub
This will insert the three rows. It will prompt you for each time it inserts.

You can't insert multiple items using the VALUES specification of the INSERT INTO syntax. For multiple items, you have to use INSERT INTO with SELECT
Code:
 
INSERT INTO table1 (id, value)
SELECT id, value FROM table2
is an example.

Let me know how you get on.
Cheers
Chris
Reply With Quote