• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

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!
  • 2
2 Solutions
Post the query behind the combobox.
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.
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.

EE Admin

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now