×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Using List box to delete records?

Using List box to delete records?

Using List box to delete records?

(OP)
Hello. I'm new here, and very novice with Access, so try to bear with me. =)

I'm working on an Access project, with a database on a little MSDE server.

I'm trying to make a form that has a list box, from which the user is supposed to select a record and then delete it by clicking on a button. Ok now, I have the box, the records in it and a button that is supposed to delete the record chosen and then requery the box. If I choose only the first record in the list and delete that everything works fine, but if I choose some other, I get a notification that tells me that primary key constraint can't allow duplicate names. What is with this? The list box isn't exactly "choosing" anything or what?

RE: Using List box to delete records?

You must have the list box bound to a field in the underlying table. When you choose a value other than the one the bound field already has, the effect is to try to update the bound field in the table. Apparently this is your key field, so you're trying to change the key to the same key as another record has.

If you just make the field unbound by erasing its Control Source property, I think it will probably work.

Rick Sprague

RE: Using List box to delete records?

(OP)
Hm, according to the navigation buttons, if I bound the list box choosing the records from the box doesn't actually change the current record. Then, if I use the nav buttons to go thru the records, the list hilights the record I've selected and deleting it goes fine. If I unbound the box, the result is the same except that the box doesn't hilight anything. Thus, it would appear that the list box is merely a "decoration" here, showing the records all right but not giving any fuctionality.

RE: Using List box to delete records?

(OP)
Duh, forget about that, I got it now (had a stupid error there). Thanks for help, Rick!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close