We help IT Professionals succeed at work.

How do I replace the information in a datatable with different selections from a combo box?

Microsoft Access - SQL

I've got the code right, as anytime a user selects a UID or NAME from each combo box the datatable fills that information based on that person's UID or NAME, however, how do I make it so that the datatable continuously replaces the newly selected information rather than keeping the previous information there?

Imagine this showing up on a data table...you select UID = 1 and Jason and his information shows up, but then you select NAME = Maria, her info shows up, but Jason's remains...I only want one of them showing up everytime I select it from the combo box...

My code:

SELECT eDiscovery.NAME, eDiscovery.CASE FROM eDiscovery WHERE (((eDiscovery.UID)=Forms!frmMarimba!cmbUID)) Or (((eDiscovery.NAME)=Forms!frmMarimba!cmbNAME));

This is in the Row Source code space for the form (frmMarimba). How can I make it so only one row of data appears everytime I select something different from the combo box? Thanks!
Comment
Watch Question

Commented:
Post the query behind the combobox.
Commented:
its not "leaving" the data in there, it is fully refreshing the data, but the way your SQL statement is written, its getting all rows where the name matches the name selected, combined with all rows where the uid matches the uid selected. so when you have both a name and a uid selected, it will show 2 rows.
Commented:
You should have only one combo box, with two columns, ID and Name, showing the Name but storing the ID.  Then for the form recordsource:

SELECT eDiscovery.NAME, eDiscovery.CASE FROM eDiscovery WHERE eDiscovery.UID)=Forms!frmMarimba!cmbUID;
Forced accept.

Computer101
EE Admin

Explore More ContentExplore courses, solutions, and other research materials related to this topic.