"Devin Panchal" <d.panchal DeleteThis @ntlworld.com> wrote in message
news:vg6Od.591$1Y.585@newsfe4-gui.ntli.net...
| hi,
|
| Dim Assignment2 As Connection
| Dim rs As Recordset
|
| Private Sub cmdAddRecord_Click()
| Dim i As Integer
| Set db1 = New ADODB.Connection
| db1.Provider = "Microsoft.Jet.OLEDB.4.0;"
| db1.ConnectionString = "..."
| db1.Open
| Dim ar As ADODB.Recordset
| Set ar = New ADODB.Recordset
|
| ar.Open "select * from submission_info", Assignment2, adOpenDynmic,
| adLockOptimistic
|
|
| but when i run the code and click on add, i get an error sayding 'the
| connection cannot be used to perform this operation. it is either
closed or
| invalid in this context'.
|
You have specified Assignment2 as the connection object for your
recordset, but you have opened the db1 connection object. Either open
the Assignment2 connection, or pass db1 as the connection for your
recordset.
>> Stay informed about: adding records into a database using vb