Go Back   oOple.com Forums > General > The PlayGround

Reply
 
Thread Tools Display Modes
  #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
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:00 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
oOple.com