[AccessD] FW: ADO

Michael Maddison michael at ddisolutions.com.au
Tue Oct 3 20:45:40 CDT 2006


No expert either but I would do it like this.

Conn.Execute  "INSERT INTO [tIVProjectDetail] ( [ProjectID#], Item,
Amount
) " & _
                 "SELECT '" & PID & "', ""Wills (2):"", 0"

If the connectionstring is wrong it will 'barf' on the Open statement.
Not sure you can use a recordset to do inserts?
You can still wrap in transactions if you like.

cheers


Michael Maddison

DDI Solutions Pty Ltd
michael at ddisolutions.com.au
Bus: 0260400620
Mob: 0412620497
www.ddisolutions.com.au 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Beach Access
Software
Sent: Wednesday, 4 October 2006 10:14 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] FW: ADO

Dear List:

 

I'm not an ADO guy.  Is there something wrong with the insert statement?
I'm assuming the connection string is valid.  If it isn't would it barf
on Conn.ConnectionString = Bwq?

 

I believe that the code execute4s without blowing but the record does
not appear in the table.

 

MTIA,

 

Rocky

 

 

   _____  

From: James Charlton [mailto:James at charltonweeks.com]
Sent: Tuesday, October 03, 2006 2:02 PM
To: Rocky Smolin
Subject: ADO

 

Any guess why this does not apend the required record?

Bwq is the connection string from a global constant

 

 

Public Sub IVWills(ByVal PID As Integer)
   Dim Conn As ADODB.Connection, RS As ADODB.Recordset
   Set Conn = New ADODB.Connection
   Conn.ConnectionString = Bwq
   Conn.Open
   Set RS = New ADODB.Recordset
   RS.ActiveConnection = Conn
   RS.Source = "INSERT INTO [tIVProjectDetail] ( [ProjectID#], Item,
Amount
) " & _
                 "SELECT '" & PID & "', ""Wills (2):"", 0"

 

   'Start the transaction
   Conn.BeginTrans
   RS.Open
   Conn.CommitTrans   ' Commit the transaction
   
   Conn.Close
End Sub

 

 

 

 

 

 

 

 

James W. M. Charlton

Charlton Weeks LLP

Attorneys at Law

(661) 265-0969

(800) 388-9878

 


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.12/461 - Release Date:
10/2/2006



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.12/461 - Release Date:
10/2/2006
 
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list