473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Deleting a record from a table.

Hi,

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
'Loop

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
works.

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
2 1265
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
DAO.DataBase
DAO.Recordset
****
I would use ADO as follows

Dim rsGiant as ADODB.Recordset

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

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

With rsGiant
While Not .EOF
... whatever
.MoveNext
Loop

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
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!)

Thanks,
Pieter

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: XmlAdoNewbie | last post by:
Hi All, I am using Microsoft SQL Enterprise Manager version 8.0 and have created a view from a combination of 4 different tables. I would like to be able to go into sql and open the view and...
1
by: Mark | last post by:
This question refers to a main form with a continuous form subform. After an error occurs after entering several records in the subform, how can I delete all the data in the main form and all the...
3
by: Nathan Bloom | last post by:
Hi, I have a data entry form (access 2000) that also allows the user to add, update, and delete records from the form. The Delete action is carried out in an event procedure and has the...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
0
by: ET | last post by:
We have two tables... one with primary key ID and second table with secondary key to the ID in the first table... Now, they query pulls records from both tables, looks like this: SELECT...
46
by: DP | last post by:
hi, i've got a form, with a subform in it. i've got a delete button in the subform. the code i;ve got is; Private Sub cmdDeleteRecord_Click() msg = "Are you sure you want to delete this...
19
by: MaXX | last post by:
Hi, I hope I'm not OT. I have the following issue: I want to delete a record from my db with a php script. Let's say I'm auth'd and I want to delete the record id 440. With a simple form (get...
1
by: gaurkamal | last post by:
I want to delete record in table B when i delete record in Table A both table have a common column. I want to do it using trigger .Can any body give some idea. Table details are. Table A: ...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
4
by: sphinney | last post by:
I'm not exactly sure how to start this post. My question is pretty simple, but it will take a little bit of context before I can state it. (And thanks in advance for taking the time to read this!) ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.