Combobox to delete records from table?

knarlyd@hotmail.com

Registered User.
Local time
Today, 02:11
Joined
Sep 6, 2013
Messages
43
I have a very simple 2010 Access database with only one table which contains a few fields (username, email, phone....)

I have a combobox with unbound controls to search/find users (by the lastname field).
The combobox is in the header section which populates the fields (controls?) in subform below.
I have a delete button with some VBA code which allows the user to delete the currently displayed record however when the form refreshes, I end up with two issues:

1: I see #deleted# in the combobox dropdown until the dbase is closed/reopened (it's only typically used by one person at a time.) Compact/Repair doesn't seem necessary, especially since i think it's pretty difficult to do this programatically (?)

2: There are blank rows in the combobox dropdown from where the data used to reside after deleting the record.

I haven't been able to figure out how to remove those blank rows and refresh the combobox to display the remaining records (with the blank rows removed). So I have dozens of blank rows. Me.Requery doesn't seem to help.

My assumption is that the blank rows exist because I'm deleting the content from the combobox's initial creation?

Is there a better way to allow user's to see the list of user's and then be able to select that record and delete it?

If I use a simple search box on a form where people have to type a (last name for example), if it's spelled incorrectly, then nothing would be found.

I've searched high and low for ways to do this and haven't been able to find a better process or a solution.:banghead:

Any assistance/code (if necessary) would be awesome!

Thanks!
 
From your description, I think you need to do a Requery, rather than a Refresh, after deleting Records.

Linq ;0)>
 
From your description, I think you need to do a Requery, rather than a Refresh, after deleting Records.

Linq ;0)>

Ya know, I thought I had tried that too...but it seems to be working with me.requery

However, the combobox still shows #deleted# until form is closed/opened

On a side note, I've been reading for about 4+ months trying to learn a little Access VBA and I just wanted to say THANKS a bunch to you because you answer a TON of questions!
;)
 
Comboboxes/Listboxes have to be Requeried independently of the Form they appear on:

ComboboxName.Requery

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom