Inserting Records Into an Access DB 
Author Message
 Inserting Records Into an Access DB

Can anyone recommend a good site that explains how to interact with an
Access DB using ADO?  I'm able to pull info out of the database, but I can't
figure out how to insert a new record.  Thanks!


Thu, 12 May 2005 13:24:56 GMT  
 Inserting Records Into an Access DB


Quote:
> Can anyone recommend a good site that explains how to
> interact with an Access DB using ADO?  I'm able to pull
> info out of the database, but I can't figure out how to
> insert a new record.  Thanks!

Try http://www.geocities.com/~chuckeasttom/vb/Vb.htm

Then go to database programming 101.



Fri, 13 May 2005 06:11:21 GMT  
 Inserting Records Into an Access DB


Quote:
>Can anyone recommend a good site that explains how to interact with an
>Access DB using ADO?

For a good FAQ see: <http://www.able-consulting.com/ADO_Faq.htm>

--
Charles Calvert             |  Software Design/Development
Celtic Wolf, Inc.           |  Project Management
http://www.celticwolf.com/  |  Technical Writing
(703) 580-0210              |  Research



Sat, 14 May 2005 01:54:13 GMT  
 Inserting Records Into an Access DB
Very helpful, Robert!

There's an excellent paper in MSDN (and MSDN Online) called 'Porting
DAO Code to ADO with the Microsoft Jet Provider'. It takes each thing
you can do with DAO and shows how you do it with ADO. It's just as
useful for seeing the things you can do and how to do them. Each topic
has straightforward code examples. After that I strongly recommend Rob
MacDonald's book Serious ADO (published by Apress). Not too expensive
and more useful than just about all the other VB database books put
together.

Quote:



> > Can anyone recommend a good site that explains how to
> > interact with an Access DB using ADO?  I'm able to pull
> > info out of the database, but I can't figure out how to
> > insert a new record.  Thanks!

> Try http://www.geocities.com/~chuckeasttom/vb/Vb.htm

> Then go to database programming 101.



Sat, 14 May 2005 19:23:09 GMT  
 Inserting Records Into an Access DB
I went to that site (btw, very informative) but I get an error when I run my
program.  I have a button on the form called cmdAddData.  Under the
cmdAddData_Click() procedure I have the following:

Private Sub cmdAddData_Click()
Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase("D:\test.mdb")
Set rs = db.OpenRecordset("Customer", dbOpenTable)
rs.AddNew
rs.Fields("cust_id") = txtCust_ID.Text
rs.Close
Set rs = Nothing
End Sub

When I fill out the form and click on the cmdAddData button, I get a
run-time error (3343) on the Set db line saying "Unrecognized database
format 'D:\test.mdb'."   I created the database with Access2000 and made
sure that the database is there.  Any suggestions?


Quote:


> > Can anyone recommend a good site that explains how to
> > interact with an Access DB using ADO?  I'm able to pull
> > info out of the database, but I can't figure out how to
> > insert a new record.  Thanks!

> Try http://www.geocities.com/~chuckeasttom/vb/Vb.htm

> Then go to database programming 101.



Mon, 16 May 2005 05:39:21 GMT  
 Inserting Records Into an Access DB
Have you added the right DAO reference? Use the menu
Project|References and make sure that Microsoft DAO 3.6 Object Library
is ticked. (And also that none of the other Microsoft DAO items is
ticked!)
Quote:

> I went to that site (btw, very informative) but I get an error when I run my
> program.  I have a button on the form called cmdAddData.  Under the
> cmdAddData_Click() procedure I have the following:

> Private Sub cmdAddData_Click()
> Dim db As Database
> Dim rs As Recordset
> Set db = OpenDatabase("D:\test.mdb")
> Set rs = db.OpenRecordset("Customer", dbOpenTable)
> rs.AddNew
> rs.Fields("cust_id") = txtCust_ID.Text
> rs.Close
> Set rs = Nothing
> End Sub

> When I fill out the form and click on the cmdAddData button, I get a
> run-time error (3343) on the Set db line saying "Unrecognized database
> format 'D:\test.mdb'."   I created the database with Access2000 and made
> sure that the database is there.  Any suggestions?





> > > Can anyone recommend a good site that explains how to
> > > interact with an Access DB using ADO?  I'm able to pull
> > > info out of the database, but I can't figure out how to
> > > insert a new record.  Thanks!

> > Try http://www.geocities.com/~chuckeasttom/vb/Vb.htm

> > Then go to database programming 101.



Mon, 16 May 2005 17:27:12 GMT  
 Inserting Records Into an Access DB
Converting your access database to a previous version can sometimes solve
the problem as well. Try. Since you used Access2000



Quote:
> Can anyone recommend a good site that explains how to interact with an
> Access DB using ADO?  I'm able to pull info out of the database, but I
can't
> figure out how to insert a new record.  Thanks!



Mon, 16 May 2005 17:36:15 GMT  
 Inserting Records Into an Access DB
convert database to Access 97.



Quote:
> I went to that site (btw, very informative) but I get an error when I run
my
> program.  I have a button on the form called cmdAddData.  Under the
> cmdAddData_Click() procedure I have the following:

> Private Sub cmdAddData_Click()
> Dim db As Database
> Dim rs As Recordset
> Set db = OpenDatabase("D:\test.mdb")
> Set rs = db.OpenRecordset("Customer", dbOpenTable)
> rs.AddNew
> rs.Fields("cust_id") = txtCust_ID.Text
> rs.Close
> Set rs = Nothing
> End Sub

> When I fill out the form and click on the cmdAddData button, I get a
> run-time error (3343) on the Set db line saying "Unrecognized database
> format 'D:\test.mdb'."   I created the database with Access2000 and made
> sure that the database is there.  Any suggestions?





> > > Can anyone recommend a good site that explains how to
> > > interact with an Access DB using ADO?  I'm able to pull
> > > info out of the database, but I can't figure out how to
> > > insert a new record.  Thanks!

> > Try http://www.geocities.com/~chuckeasttom/vb/Vb.htm

> > Then go to database programming 101.



Sun, 22 May 2005 19:16:17 GMT  
 Inserting Records Into an Access DB

You might want to reference(projects>references>MS DAO 3.6
Object Library.

Also,

Quote:
> Dim db As Database
> Dim rs As Recordset

Should be
        Dim db as DAO.database
        Dim rs as DAO.recordset
Be sure you are running SP5 with VB.



Quote:
> Subject: Re: Inserting Records Into an Access DB

> Newsgroups: comp.lang.basic.visual.database

> convert database to Access 97.



>> I went to that site (btw, very informative) but I get an
>> error when I run
> my
>> program.  I have a button on the form called cmdAddData.
>> Under the cmdAddData_Click() procedure I have the
>> following:

>> Private Sub cmdAddData_Click()
>> Dim db As Database
>> Dim rs As Recordset
>> Set db = OpenDatabase("D:\test.mdb")
>> Set rs = db.OpenRecordset("Customer", dbOpenTable)
>> rs.AddNew
>> rs.Fields("cust_id") = txtCust_ID.Text
>> rs.Close
>> Set rs = Nothing
>> End Sub

>> When I fill out the form and click on the cmdAddData
>> button, I get a run-time error (3343) on the Set db line
>> saying "Unrecognized database format 'D:\test.mdb'."   I
>> created the database with Access2000 and made sure that
>> the database is there.  Any suggestions?


>> message



>> > > Can anyone recommend a good site that explains how to
>> > > interact with an Access DB using ADO?  I'm able to
>> > > pull info out of the database, but I can't figure out
>> > > how to insert a new record.  Thanks!

>> > Try http://www.geocities.com/~chuckeasttom/vb/Vb.htm

>> > Then go to database programming 101.



Sun, 22 May 2005 20:54:07 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. duplicate records inserted into access DB

2. Inserting a Record into a MS Access DB While Inside a Loop

3. STUMPED: Inserting DB Record w/ ASP and Access

4. duplicate records inserted into access DB

5. Example of inserting record to Access DB using RDS

6. Inserting records from access db into MSSQL

7. INSERT INTO Access DB from SQL DB-HELP!!

8. accessing records in one secure DB from another secure DB - programatically

9. Inserting Records in DB Grid

10. Inserting Records in DB Grid

11. Inserting records into a DB table.

12. inserting records from one db to another

 

 
Powered by phpBB® Forum Software