keeping track of records loaded to sql 
Author Message
 keeping track of records loaded to sql

I have an app that loads account codes and balances to sql.  The table
in sql has a primary key that only allows me to load one account code.
I'm using .addnew/.update to add the records and save my changes as i
load the records to the db.  I'm actually using VBA in Excel to do this
and as I load each record I move to the next row, and next account
code.  My problem is that the users aren't keeping track of their
account codes and I'm getting 3146 ODBC errors because of the primary
key.

Any suggestions on how I can keep track of the account codes that I've
already loaded as I'm processing the load?

Thanks, Andre



Fri, 30 Nov 2001 03:00:00 GMT  
 keeping track of records loaded to sql
Hi Andre,

Quote:
> Any suggestions on how I can keep track of the account codes that I've
> already loaded as I'm processing the load?

Assuming your table is called "AccountBalance", using DAO:

 Set oRS = <database>.OpenRecordset("AccountBalance")
 oRS.Index = "PrimaryKey"

 oRS.Seek "=", sAccountcode

 If oRs.NoMatch Then
     oRS.AddNew
     oRS!Account = sAccountCode
 Else
     oRS.Edit
 End If

 oRS!Balance = dAccountBalance

 oRS.Update

 HTH

 Stephen Bullen
 Microsoft MVP - Excel
 http://www.BMSLtd.co.uk



Fri, 30 Nov 2001 03:00:00 GMT  
 keeping track of records loaded to sql
If you're sure that dupe key is the only error you will hit, you might just
put On Error Resume Next before the add and then reset your error checking
right after.

.  My problem is that the users aren't keeping track of their

Quote:
>account codes and I'm getting 3146 ODBC errors because of the primary
>key.

>Any suggestions on how I can keep track of the account codes that I've
>already loaded as I'm processing the load?

>Thanks, Andre



Fri, 30 Nov 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Keeping track of loaded programs

2. keeping Track Of Record

3. Keep track of excludes for each record

4. Database help - keeping track of records...

5. Keep Track of Excluded Users for each Record

6. using 3rd pty sw, keeping track of records

7. Database help - keeping track of records...

8. JCN - KEEPING TRACKS OF ALL CHANGES TO RECORDS IN AN ACCESS DATABASE

9. Keep Track of Excluded Users for each record

10. Keeping Track of Database Modifications?!?!

11. Keeping track of Users Online

12. Keeping track of Database changes!?

 

 
Powered by phpBB® Forum Software