Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I Add records without opening a Recordset?
Message
From
29/08/2001 08:40:36
GW Gross
{Banned by Information Security Policy}
Lake Mary, Florida, United States
 
 
To
28/08/2001 17:01:05
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00550030
Message ID:
00550223
Views:
16
Thanks JCF,

I am just curious .... do you just "make up" somehthing for the Where clause that returns an empty recordset or did the 1=0 have specific meaning.

I will change this in my code and it should speed things.

Thanks for the help.

>If you're only adding records here, bring in an empty recordset by changing your source as follows:
>
gstrSQL = "Select * From Batch Where 1=0"
>This will bring in an empty recordset with all the properties of the source table.
>
>HTH
>
>>I am sure there must be an easier way, but I haven't figured it out yet.
>>
>>This is what I am doing now:
>>
>>
>>
>>'Connect to the database
>>set gcnSPOT = New Connection
>>
>>With gcnSPOT
>>
>>  .Provider = gdbeJet4
>>  .ConnectionString = "Data Source =" & gstrSPOTDB
>>  .Open
>>
>>End With
>>
>>'Create recordset
>>set grsSPOTBatch = New Recordset
>>
>>'Populate recordset
>>gstrSQL = "Select * From Batch"
>>
>>grsSPOTBatch.Open gstrSQL, gcnSPOT, adOpenKeySet, adLockOptimistic
>>
>>
>>'Create a new record
>>grsSPOTBatch.AddNew
>>
>>'Populate the new record
>>
>>for mintLoop = 0 to (grsSPOTBatch.Fields.Count-1)
>>
>>   grsSPOTBatch.Fields.Item(mintLoop).Value = garyDataArray(mintLoop)
>>
>>next
>>
>>grsSPOTBatch.Update
>>
>>
>>
>>I am basically opening a recordset, that is now getting very large with a Select * command, just so I can put new data in.
>>
>>This is a MSAccess2000 database.
>>
>>The garyDataArray is actually a recordset from another database (which is MSAccess97). I am trying to move all of the data from that database to gcnSPOT into identical tables.
>>
>>I tried an Insert command but had errors on some of the tables because the first field is an "Autonumber" field and I want to keep the orginal number.
>>
>>Any help would be appreciated.
>>
>>Thanks,
GW Gross

"You are blessed when you're content with just who you are - no more, no less." Matthew 5:5 (The Message)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform