Append row 'error' (1 Viewer)

liamfitz

Registered User.
Local time
Today, 08:27
Joined
May 17, 2012
Messages
240
Hi. I'm dynamically populating a table I create, at a report Load event. ( The field values will be based on values taken/calculated from fields in 2 other existing tables ). The following code just places some test data into the 2 fields for now, to check the logic and functionality of my routine.
Code:
Dim sql as String
sql = "CREATE TABLE tempTbl(Outcome varchar(60), Total int)"
DoCmd.RunSQL sql
For i = 0 To 7
    sql = "INSERT INTO tempTbl VALUES('Just some text', " & i & ")"
    DoCmd.RunSQL sql
    sql = ""
Next i
The trouble is, it prompts me with an append question for every new record as it adds each new row. Can this be avoided, and if so, how please ? Thank you in advance.:confused:
 

jdraw

Super Moderator
Staff member
Local time
Today, 03:27
Joined
Jan 23, 2006
Messages
13,307
Replace this
DoCmd.RunSQL sql

with
Currentdb.execute sql, dbFailOnError

Good luck
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom