By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,583 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

Deleting a record from a table.

P: n/a

I am writing code for a project I am working on using Accewss 2000, and
when I choose an item from a drop-down box, I want to delete it form
the table it is getting the info from.

I am using the following code:

'Dim dbGiant As Database
'Dim rsGiant As Recordset

'Set dbMyDB = OpenDatabase("Giants_Sign-UP.mdb")
'Set dbGiant = CurrentDb()
'Set rsGiant = dbGiant.OpenRecordSet("school_all", dbOpenDynaset)

'If Not rsGiant.EOF Then rsGiant.MoveFirst
'Do While Not rsGiant.EOF
'lstRecords.AddItem rsMyRS!Name
'lstRecords.ItemData(lstRecords.NewIndex) = rsMyRS!ID
' If Me!cmb_session_date.Value = rsGiant!school_name Then
' Debug.Print "Match"
' rsGiant.MoveNext

But, everytime I invoke it, I come up with the following error when I
have the first 2 lines uncommented:

Complie Error: User-defined type not defined

Now, I wil admit I learned Access using 97, and this is 2000, and I am
not full up on the new way of 2000. But, I have an older project that
I converted to use with 2000, and have almost the same code, and that

Another qustion, excuse my naivity, but when I do help, it gives me
this code, which I fully understand, and other code using OCDBC.

If someone can help me either point to a place to help me understand
this, or just help me to an understanding of how the NEW Access works?

Joe R.

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Access 2000 defaults to ADO.

If you want to use DAO then be sure there is a DAO reference in your
references and qualify your objects as
I would use ADO as follows

Dim rsGiant as ADODB.Recordset

Set rsGiant=CurrentProject.Connection.Execute("School_ All")
(assuming School_All is a query)

Set rsGiant=CurrentProject.Connection.Execute("SELECT * FROM
(assuming School_All is a table or view)

With rsGiant
While Not .EOF
... whatever

This has several fewer lines than DAO and does nor require the release
of the recordset variable. You should be aware that the code presented
is untested "air code" and may have syntax errors and that many
regulars here are committed to using DAO only for Access-JET. I never
use DAO in code (although Access may).

Nov 13 '05 #2

P: n/a
I know this is hijacking a topic (shame on me!), but what's the most
useful resource you've come across to learn ADO? I started learning it
when it just came out, and the documentation was so bad that I just
used DAO instead. Much easier to find info on...

I guess any resources would be good... David Fenton said that Chipman &
Baron's book on Access/SQL Server was really good. Are there any
others that you know of? IIRC, David Sussman wrote one for Wrox that
was supposed to be okay...

any ideas/opinions? And which books are *terrible*? (Won't waste my
time looking at them then!)


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.